﻿Public Class FrmPropDownBill
    Private FBillInfo As New BServer.FBillPropDown
    Public FOpenType As String
    Public FBid As Integer
    Private FPInfo As New BServer.FBillPrintCFG
    Private FLoad As Boolean
    Private FComboLock As Boolean
#Region "进入界面"
    Private Sub FrmPropDownBill_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        FDateBox.Value = Now.Date
        Select Case FOpenType
            Case "New"
                If SControl._User_CheckAuth(UInfo.FSession, "BILL", "FPDBILLNEW", Nothing) = False Then
                    MsgBox("没有权限!")
                    Dispose()
                    Return
                End If
                FUpBtn.Checked = False
                FDownBtn.Checked = True
                NewBill()
            Case "View"
                If CStr(FBid).Trim <> String.Empty And CStr(FBid) <> "0" Then
                    FBillInfo.id = FBid
                    If GetBill(FBid) = False Then
                        Dispose()
                        Return
                    End If
                End If
            Case Else
                MsgBox("参数错误!")
                Dispose()
                Return
        End Select
        FLoad = True
    End Sub
#End Region
#Region "设置单据类型所需要的禁用组件"
    Private Sub CHGCON()
        If FDownBtn.Checked = True Then
            '--地下
            FSDate6Box.Enabled = True
            FEDate6Box.Enabled = True
            FQty6Box.Enabled = True
            FPrice6Box.Enabled = True
            FDays6Box.Enabled = True

            FSDate7Box.Enabled = True
            FEDate7Box.Enabled = True
            FQty7Box.Enabled = True
            FPrice7Box.Enabled = True
            FDays7Box.Enabled = True

            FSDate8Box.Enabled = True
            FEDate8Box.Enabled = True
            FQty8Box.Enabled = True
            FPrice8Box.Enabled = True
            FDays8Box.Enabled = True

            FSDate9Box.Enabled = True
            FEDate9Box.Enabled = True
            FQty9Box.Enabled = True
            FPrice9Box.Enabled = True
            FDays9Box.Enabled = True

            FSDate10Box.Enabled = True
            FEDate10Box.Enabled = True
            FQty10Box.Enabled = True
            FPrice10Box.Enabled = True
            FDays10Box.Enabled = True

            FSDate11Box.Enabled = True
            FEDate11Box.Enabled = True
            FQty11Box.Enabled = True
            FPrice11Box.Enabled = True
            FDays11Box.Enabled = True

            FSDate12Box.Enabled = True
            FEDate12Box.Enabled = True
            FQty12Box.Enabled = True
            FPrice12Box.Enabled = True
            FDays12Box.Enabled = True

            FSDate13Box.Enabled = True
            FEDate13Box.Enabled = True
            FQty13Box.Enabled = True
            FPrice13Box.Enabled = True
            FDays13Box.Enabled = True

            FSDate14Box.Enabled = True
            FEDate14Box.Enabled = True
            FQty14Box.Enabled = True
            FPrice14Box.Enabled = True
            FDays14Box.Enabled = True

            FSDate15Box.Enabled = True
            FEDate15Box.Enabled = True
            FQty15Box.Enabled = True
            FPrice15Box.Enabled = True
            FDays15Box.Enabled = True
            Text = "家和美物业收费收据"
            FCaptionLabel.Text = "家和美物业收据"
        ElseIf FUpBtn.Checked = True Then
            '--地上
            FSDate6Box.Enabled = False
            FEDate6Box.Enabled = False
            FQty6Box.Enabled = False
            FPrice6Box.Enabled = False
            FDays6Box.Enabled = False

            FSDate7Box.Enabled = False
            FEDate7Box.Enabled = False
            FQty7Box.Enabled = False
            FPrice7Box.Enabled = False
            FDays7Box.Enabled = False

            FSDate8Box.Enabled = False
            FEDate8Box.Enabled = False
            FQty8Box.Enabled = False
            FPrice8Box.Enabled = False
            FDays8Box.Enabled = False

            FSDate9Box.Enabled = False
            FEDate9Box.Enabled = False
            FQty9Box.Enabled = False
            FPrice9Box.Enabled = False
            FDays9Box.Enabled = False

            FSDate10Box.Enabled = False
            FEDate10Box.Enabled = False
            FQty10Box.Enabled = False
            FPrice10Box.Enabled = False
            FDays10Box.Enabled = False

            FSDate11Box.Enabled = False
            FEDate11Box.Enabled = False
            FQty11Box.Enabled = False
            FPrice11Box.Enabled = False
            FDays11Box.Enabled = False

            FSDate12Box.Enabled = False
            FEDate12Box.Enabled = False
            FQty12Box.Enabled = False
            FPrice12Box.Enabled = False
            FDays12Box.Enabled = False

            FSDate13Box.Enabled = False
            FEDate13Box.Enabled = False
            FQty13Box.Enabled = False
            FPrice13Box.Enabled = False
            FDays13Box.Enabled = False

            FSDate14Box.Enabled = False
            FEDate14Box.Enabled = False
            FQty14Box.Enabled = False
            FPrice14Box.Enabled = False
            FDays14Box.Enabled = False

            FSDate15Box.Enabled = False
            FEDate15Box.Enabled = False
            FQty15Box.Enabled = False
            FPrice15Box.Enabled = False
            FDays15Box.Enabled = False
            Text = "地上层物业收费收据"
            FCaptionLabel.Text = "地上1--4层物业收据"
        Else
            MsgBox("未知错误!")
            Dispose()
            Return
        End If
    End Sub
#End Region
#Region "新建单据"
    Private Sub NewBill()
        FBillInfo = New BServer.FBillPropDown
        GetCustomList()
        GetItemList()
        '--清除
        FUNameBox.Text = Nothing
        FPNameBox.Text = Nothing
        FBillNoBox.Text = Nothing
        FVerifyBox.Text = Nothing
        FOpenType = "New"
        FDisCont(True)
        FSaveBox.Enabled = True
        FSaveBox.Text = "保存"
        FPrintBox.Enabled = False
        FUNameBox.Text = UInfo.FRName
        '--清除现在数据
        FSDate1Box.Value = Nothing
        FEDate1Box.Value = Nothing
        FDays1Box.Value = 0
        FQty1Box.Value = 0
        FPrice1Box.Value = 0

        FSDate2Box.Value = Nothing
        FEDate2Box.Value = Nothing
        FDays2Box.Value = 0
        FQty2Box.Value = 0
        FPrice2Box.Value = 0

        FSDate3Box.Value = Nothing
        FEDate3Box.Value = Nothing
        FDays3Box.Value = 0
        FQty3Box.Value = 0
        FPrice3Box.Value = 0

        FSDate4Box.Value = Nothing
        FEDate4Box.Value = Nothing
        FDays4Box.Value = 0
        FQty4Box.Value = 0
        FPrice4Box.Value = 0

        FSDate5Box.Value = Nothing
        FEDate5Box.Value = Nothing
        FDays5Box.Value = 0
        FQty5Box.Value = 0
        FPrice5Box.Value = 0

        FSDate6Box.Value = Nothing
        FEDate6Box.Value = Nothing
        FDays6Box.Value = 0
        FQty6Box.Value = 0
        FPrice6Box.Value = 0

        FSDate7Box.Value = Nothing
        FEDate7Box.Value = Nothing
        FDays7Box.Value = 0
        FQty7Box.Value = 0
        FPrice7Box.Value = 0

        FSDate8Box.Value = Nothing
        FEDate8Box.Value = Nothing
        FDays8Box.Value = 0
        FQty8Box.Value = 0
        FPrice8Box.Value = 0

        FSDate9Box.Value = Nothing
        FEDate9Box.Value = Nothing
        FDays9Box.Value = 0
        FQty9Box.Value = 0
        FPrice9Box.Value = 0

        FSDate10Box.Value = Nothing
        FEDate10Box.Value = Nothing
        FDays10Box.Value = 0
        FQty10Box.Value = 0
        FPrice10Box.Value = 0

        FSDate11Box.Value = Nothing
        FEDate11Box.Value = Nothing
        FDays11Box.Value = 0
        FQty11Box.Value = 0
        FPrice11Box.Value = 0

        FSDate12Box.Value = Nothing
        FEDate12Box.Value = Nothing
        FDays12Box.Value = 0
        FQty12Box.Value = 0
        FPrice12Box.Value = 0

        FSDate13Box.Value = Nothing
        FEDate13Box.Value = Nothing
        FDays13Box.Value = 0
        FQty13Box.Value = 0
        FPrice13Box.Value = 0

        FSDate14Box.Value = Nothing
        FEDate14Box.Value = Nothing
        FDays14Box.Value = 0
        FQty14Box.Value = 0
        FPrice14Box.Value = 0

        FSDate15Box.Value = Nothing
        FEDate15Box.Value = Nothing
        FDays15Box.Value = 0
        FQty15Box.Value = 0
        FPrice15Box.Value = 0

        CHGCON()
    End Sub
#End Region
#Region "查看单据"
    Private Function GetBill(ByVal Fid As Integer) As Boolean
        Try
            If Fid <= 0 Then
                MsgBox("参数错误!")
                Return False
            End If
            Dim ErrString As String = String.Empty
            FBillInfo = New BServer.FBillPropDown() With {.id = Fid}
            If SControl._Bill_PropertyDown_GetBillInfo(UInfo.FSession, FBillInfo, ErrString) = False Then
                MsgBox(ErrString)
                Return False
            End If
            'If FBillInfo.FBType = 0 Then
            '    '--地下
            '    FDownBtn.Checked = True
            '    FUpBtn.Checked = False
            'ElseIf FBillInfo.FBType = 1 Then
            '    '--地上
            '    FUpBtn.Checked = True
            '    FDownBtn.Checked = False
            'Else
            '    MsgBox("无法解析返回数据!")
            '    Return False
            'End If
            '--审核权限
            If FBillInfo.FVid > 0 Then
                '--已审
                FSaveBox.Enabled = False
                FPrintBox.Enabled = True
            ElseIf FBillInfo.FVid <= 0 And FBillInfo.FUid = UInfo.id Then
                '--自制的单据,未审核
                If SControl._User_CheckAuth(UInfo.FSession, "BILL", "FPDBILLVERIFYMY", ErrString) Then
                    '--有权限
                    FSaveBox.Text = "收费"
                Else
                    '--没权限
                    FSaveBox.Text = "保存"
                    FSaveBox.Enabled = False
                End If
            ElseIf FBillInfo.FVid <= 0 And FBillInfo.FUid <> UInfo.id Then
                '--别人的单据
                If SControl._User_CheckAuth(UInfo.FSession, "BILL", "FPDBILLVERIFY", ErrString) Then
                    FSaveBox.Enabled = True
                    FSaveBox.Text = "收费"
                Else
                    FSaveBox.Text = "保存"
                    FSaveBox.Enabled = False
                End If
            Else
                MsgBox("未知错误")
                Return False
            End If
            FDateBox.Value = FBillInfo.FDate
            FNameBox.Text = FBillInfo.FName
            FCNameBox.Text = FBillInfo.FCName
            FBillNoBox.Text = FBillInfo.FBillNo
            FVerifyBox.Text = FBillInfo.FVerifyCode
            FUNameBox.Text = FBillInfo.FUName
            FPNameBox.Text = FBillInfo.FVName
            '--分录
            FItem1Box.Enabled = False
            FSDate1Box.Enabled = False
            FEDate1Box.Enabled = False
            FDays1Box.Enabled = False
            FPrice1Box.Enabled = False
            FQty1Box.Enabled = False
            FAcc1Box.Enabled = False
            FItem1Box.Text = FBillInfo.FItemName1
            FSDate1Box.Value = FBillInfo.FSDate1
            FEDate1Box.Value = FBillInfo.FEDate1
            FQty1Box.Value = FBillInfo.FQty1
            FPrice1Box.Value = FBillInfo.FPrice1
            FDays1Box.Value = FBillInfo.FDays1
            FAcc1Box.Value = FBillInfo.FAcc1

            FItem2Box.Enabled = False
            FSDate2Box.Enabled = False
            FEDate2Box.Enabled = False
            FDays2Box.Enabled = False
            FPrice2Box.Enabled = False
            FQty2Box.Enabled = False
            FAcc2Box.Enabled = False
            FItem2Box.Text = FBillInfo.FItemName2
            FSDate2Box.Value = FBillInfo.FSDate2
            FEDate2Box.Value = FBillInfo.FEDate2
            FQty2Box.Value = FBillInfo.FQty2
            FPrice2Box.Value = FBillInfo.FPrice2
            FDays2Box.Value = FBillInfo.FDays2
            FAcc2Box.Value = FBillInfo.FAcc2

            FItem3Box.Enabled = False
            FSDate3Box.Enabled = False
            FEDate3Box.Enabled = False
            FDays3Box.Enabled = False
            FPrice3Box.Enabled = False
            FQty3Box.Enabled = False
            FAcc3Box.Enabled = False
            FItem3Box.Text = FBillInfo.FItemName3
            FSDate3Box.Value = FBillInfo.FSDate3
            FEDate3Box.Value = FBillInfo.FEDate3
            FQty3Box.Value = FBillInfo.FQty3
            FPrice3Box.Value = FBillInfo.FPrice3
            FDays3Box.Value = FBillInfo.FDays3
            FAcc3Box.Value = FBillInfo.FAcc3

            FItem4Box.Enabled = False
            FSDate4Box.Enabled = False
            FEDate4Box.Enabled = False
            FDays4Box.Enabled = False
            FPrice4Box.Enabled = False
            FQty4Box.Enabled = False
            FAcc4Box.Enabled = False
            FItem4Box.Text = FBillInfo.FItemName4
            FSDate4Box.Value = FBillInfo.FSDate4
            FEDate4Box.Value = FBillInfo.FEDate4
            FQty4Box.Value = FBillInfo.FQty4
            FPrice4Box.Value = FBillInfo.FPrice4
            FDays4Box.Value = FBillInfo.FDays4
            FAcc4Box.Value = FBillInfo.FAcc4

            FItem5Box.Enabled = False
            FSDate5Box.Enabled = False
            FEDate5Box.Enabled = False
            FDays5Box.Enabled = False
            FPrice5Box.Enabled = False
            FQty5Box.Enabled = False
            FAcc5Box.Enabled = False
            FItem5Box.Text = FBillInfo.FItemName5
            FSDate5Box.Value = FBillInfo.FSDate5
            FEDate5Box.Value = FBillInfo.FEDate5
            FQty5Box.Value = FBillInfo.FQty5
            FPrice5Box.Value = FBillInfo.FPrice5
            FDays5Box.Value = FBillInfo.FDays5
            FAcc5Box.Value = FBillInfo.FAcc5

            FItem6Box.Enabled = False
            FSDate6Box.Enabled = False
            FEDate6Box.Enabled = False
            FDays6Box.Enabled = False
            FPrice6Box.Enabled = False
            FQty6Box.Enabled = False
            FAcc6Box.Enabled = False
            FItem6Box.Text = FBillInfo.FItemName6
            FSDate6Box.Value = FBillInfo.FSDate6
            FEDate6Box.Value = FBillInfo.FEDate6
            FQty6Box.Value = FBillInfo.FQty6
            FPrice6Box.Value = FBillInfo.FPrice6
            FDays6Box.Value = FBillInfo.FDays6
            FAcc6Box.Value = FBillInfo.FAcc6

            FItem7Box.Enabled = False
            FSDate7Box.Enabled = False
            FEDate7Box.Enabled = False
            FDays7Box.Enabled = False
            FPrice7Box.Enabled = False
            FQty7Box.Enabled = False
            FAcc7Box.Enabled = False
            FItem7Box.Text = FBillInfo.FItemName7
            FSDate7Box.Value = FBillInfo.FSDate7
            FEDate7Box.Value = FBillInfo.FEDate7
            FQty7Box.Value = FBillInfo.FQty7
            FPrice7Box.Value = FBillInfo.FPrice7
            FDays7Box.Value = FBillInfo.FDays7
            FAcc7Box.Value = FBillInfo.FAcc7

            FItem8Box.Enabled = False
            FSDate8Box.Enabled = False
            FEDate8Box.Enabled = False
            FDays8Box.Enabled = False
            FPrice8Box.Enabled = False
            FQty8Box.Enabled = False
            FAcc8Box.Enabled = False
            FItem8Box.Text = FBillInfo.FItemName8
            FSDate8Box.Value = FBillInfo.FSDate8
            FEDate8Box.Value = FBillInfo.FEDate8
            FQty8Box.Value = FBillInfo.FQty8
            FPrice8Box.Value = FBillInfo.FPrice8
            FDays8Box.Value = FBillInfo.FDays8
            FAcc8Box.Value = FBillInfo.FAcc8

            FItem9Box.Enabled = False
            FSDate9Box.Enabled = False
            FEDate9Box.Enabled = False
            FDays9Box.Enabled = False
            FPrice9Box.Enabled = False
            FQty9Box.Enabled = False
            FAcc9Box.Enabled = False
            FItem9Box.Text = FBillInfo.FItemName9
            FSDate9Box.Value = FBillInfo.FSDate9
            FEDate9Box.Value = FBillInfo.FEDate9
            FQty9Box.Value = FBillInfo.FQty9
            FPrice9Box.Value = FBillInfo.FPrice9
            FDays9Box.Value = FBillInfo.FDays9
            FAcc9Box.Value = FBillInfo.FAcc9

            FItem10Box.Enabled = False
            FSDate10Box.Enabled = False
            FEDate10Box.Enabled = False
            FDays10Box.Enabled = False
            FPrice10Box.Enabled = False
            FQty10Box.Enabled = False
            FAcc10Box.Enabled = False
            FItem10Box.Text = FBillInfo.FItemName10
            FSDate10Box.Value = FBillInfo.FSDate10
            FEDate10Box.Value = FBillInfo.FEDate10
            FQty10Box.Value = FBillInfo.FQty10
            FPrice10Box.Value = FBillInfo.FPrice10
            FDays10Box.Value = FBillInfo.FDays10
            FAcc10Box.Value = FBillInfo.FAcc10

            FItem11Box.Enabled = False
            FSDate11Box.Enabled = False
            FEDate11Box.Enabled = False
            FDays11Box.Enabled = False
            FPrice11Box.Enabled = False
            FQty11Box.Enabled = False
            FAcc11Box.Enabled = False
            FItem11Box.Text = FBillInfo.FItemName11
            FSDate11Box.Value = FBillInfo.FSDate11
            FEDate11Box.Value = FBillInfo.FEDate11
            FQty11Box.Value = FBillInfo.FQty11
            FPrice11Box.Value = FBillInfo.FPrice11
            FDays11Box.Value = FBillInfo.FDays11
            FAcc11Box.Value = FBillInfo.FAcc11

            FItem12Box.Enabled = False
            FSDate12Box.Enabled = False
            FEDate12Box.Enabled = False
            FDays12Box.Enabled = False
            FPrice12Box.Enabled = False
            FQty12Box.Enabled = False
            FAcc12Box.Enabled = False
            FItem12Box.Text = FBillInfo.FItemName12
            FSDate12Box.Value = FBillInfo.FSDate12
            FEDate12Box.Value = FBillInfo.FEDate12
            FQty12Box.Value = FBillInfo.FQty12
            FPrice12Box.Value = FBillInfo.FPrice12
            FDays12Box.Value = FBillInfo.FDays12
            FAcc12Box.Value = FBillInfo.FAcc12

            FItem13Box.Enabled = False
            FSDate13Box.Enabled = False
            FEDate13Box.Enabled = False
            FDays13Box.Enabled = False
            FPrice13Box.Enabled = False
            FQty13Box.Enabled = False
            FAcc13Box.Enabled = False
            FItem13Box.Text = FBillInfo.FItemName13
            FSDate13Box.Value = FBillInfo.FSDate13
            FEDate13Box.Value = FBillInfo.FEDate13
            FQty13Box.Value = FBillInfo.FQty13
            FPrice13Box.Value = FBillInfo.FPrice13
            FDays13Box.Value = FBillInfo.FDays13
            FAcc13Box.Value = FBillInfo.FAcc13

            FItem14Box.Enabled = False
            FSDate14Box.Enabled = False
            FEDate14Box.Enabled = False
            FDays14Box.Enabled = False
            FPrice14Box.Enabled = False
            FQty14Box.Enabled = False
            FAcc14Box.Enabled = False
            FItem14Box.Text = FBillInfo.FItemName14
            FSDate14Box.Value = FBillInfo.FSDate14
            FEDate14Box.Value = FBillInfo.FEDate14
            FQty14Box.Value = FBillInfo.FQty14
            FPrice14Box.Value = FBillInfo.FPrice14
            FDays14Box.Value = FBillInfo.FDays14
            FAcc14Box.Value = FBillInfo.FAcc14

            FItem15Box.Enabled = False
            FSDate15Box.Enabled = False
            FEDate15Box.Enabled = False
            FDays15Box.Enabled = False
            FPrice15Box.Enabled = False
            FQty15Box.Enabled = False
            FAcc15Box.Enabled = False
            FItem15Box.Text = FBillInfo.FItemName15
            FSDate15Box.Value = FBillInfo.FSDate15
            FEDate15Box.Value = FBillInfo.FEDate15
            FQty15Box.Value = FBillInfo.FQty15
            FPrice15Box.Value = FBillInfo.FPrice15
            FDays15Box.Value = FBillInfo.FDays15
            FAcc15Box.Value = FBillInfo.FAcc15

            FAm1label.Text = FBillInfo.FAcc1 + FBillInfo.FAcc2 + FBillInfo.FAcc3 + FBillInfo.FAcc4 + FBillInfo.FAcc5
            FAm2label.Text = FBillInfo.FAcc6 + FBillInfo.FAcc7 + FBillInfo.FAcc8 + FBillInfo.FAcc9 + FBillInfo.FAcc10
            FAm3Label.Text = FBillInfo.FAcc11 + FBillInfo.FAcc12 + FBillInfo.FAcc13 + FBillInfo.FAcc14 + FBillInfo.FAcc15
            FAmountSMLabel.Text = Math.Round(CDec(FAm1label.Text) + CDec(FAm2label.Text) + CDec(FAm3Label.Text), 0)
            FAmountBGLabel.Text = FControl.MoneyToUpper(CDbl(FAmountSMLabel.Text))

            FPCountLabel.Text = "打印次数:" & FBillInfo.FPCount
            Return True
        Catch ex As Exception
            MsgBox(String.Format("读取单据信息失败!{0}错误信息:{1}", vbCrLf, ex.Message))
            Return False
        End Try
    End Function
#End Region
#Region "读取客户信息"
    Private Sub GetCustomList()
        Try
            Dim ds As New DataSet
            Dim ErrString As String = String.Empty
            Dim TmpArr As Byte() = Nothing
            FNameBox.DataSource = Nothing
            FCNameBox.DataSource = Nothing
            If SControl._BILL_PropertyDown_GetItemList(UInfo.FSession, TmpArr, "CUSTOM", ErrString) = False Then
                MsgBox(ErrString)
                Return
            End If
            If FControl.DsRestore(ds, TmpArr) = False Then
                MsgBox("无法解析返回数据!")
                Return
            End If
            FComboLock = True
            FNameBox.DisplayMember = "FName"
            FNameBox.ValueMember = "id"
            FNameBox.DataSource = ds.Tables(0).Copy.DefaultView
            FNameBox.SelectedIndex = -1
            FCNameBox.DisplayMember = "FCName"
            FCNameBox.ValueMember = "id"
            FCNameBox.DataSource = ds.Tables(0).Copy.DefaultView
            FCNameBox.SelectedIndex = -1
            FComboLock = False
        Catch ex As Exception
            FComboLock = False
            MsgBox(String.Format("读取客户信息失败!{0}错误信息:{1}", vbCrLf, ex.Message))
            Return
        End Try
    End Sub
#End Region
#Region "读取项目信息"
    Private Sub GetItemList()
        Try
            Dim TmpArr As Byte() = Nothing
            Dim ErrString As String = Nothing
            Dim ds As New DataSet
            '--清除原数据
            FItem1Box.DataSource = Nothing
            FItem2Box.DataSource = Nothing
            FItem3Box.DataSource = Nothing
            FItem4Box.DataSource = Nothing
            FItem5Box.DataSource = Nothing
            FItem6Box.DataSource = Nothing
            FItem7Box.DataSource = Nothing
            FItem8Box.DataSource = Nothing
            FItem9Box.DataSource = Nothing
            FItem10Box.DataSource = Nothing
            FItem11Box.DataSource = Nothing
            FItem12Box.DataSource = Nothing
            FItem13Box.DataSource = Nothing
            FItem14Box.DataSource = Nothing
            FItem15Box.DataSource = Nothing
            '--读取数据
            If SControl._BILL_PropertyDown_GetItemList(UInfo.FSession, TmpArr, "ITEM", ErrString) = False Then
                MsgBox(ErrString)
                Return
            End If
            If FControl.DsRestore(ds, TmpArr) = False Then
                MsgBox(String.Format("读取项目数据失败!{0}错误信息:{1}", vbCrLf, ErrString))
                Return
            End If
            '--写新数据
            FItem1Box.DataSource = ds.Tables(0).Copy.DefaultView
            FItem1Box.DisplayMember = "FName"
            FItem1Box.ValueMember = "id"
            FItem1Box.SelectedIndex = -1

            FItem2Box.DataSource = ds.Tables(0).Copy.DefaultView
            FItem2Box.DisplayMember = "FName"
            FItem2Box.ValueMember = "id"
            FItem2Box.SelectedIndex = -1

            FItem3Box.DataSource = ds.Tables(0).Copy.DefaultView
            FItem3Box.DisplayMember = "FName"
            FItem3Box.ValueMember = "id"
            FItem3Box.SelectedIndex = -1

            FItem4Box.DataSource = ds.Tables(0).Copy.DefaultView
            FItem4Box.DisplayMember = "FName"
            FItem4Box.ValueMember = "id"
            FItem4Box.SelectedIndex = -1

            FItem5Box.DataSource = ds.Tables(0).Copy.DefaultView
            FItem5Box.DisplayMember = "FName"
            FItem5Box.ValueMember = "id"
            FItem5Box.SelectedIndex = -1

            FItem6Box.DataSource = ds.Tables(0).Copy.DefaultView
            FItem6Box.DisplayMember = "FName"
            FItem6Box.ValueMember = "id"
            FItem6Box.SelectedIndex = -1

            FItem7Box.DataSource = ds.Tables(0).Copy.DefaultView
            FItem7Box.DisplayMember = "FName"
            FItem7Box.ValueMember = "id"
            FItem7Box.SelectedIndex = -1

            FItem8Box.DataSource = ds.Tables(0).Copy.DefaultView
            FItem8Box.DisplayMember = "FName"
            FItem8Box.ValueMember = "id"
            FItem8Box.SelectedIndex = -1

            FItem9Box.DataSource = ds.Tables(0).Copy.DefaultView
            FItem9Box.DisplayMember = "FName"
            FItem9Box.ValueMember = "id"
            FItem9Box.SelectedIndex = -1

            FItem10Box.DataSource = ds.Tables(0).Copy.DefaultView
            FItem10Box.DisplayMember = "FName"
            FItem10Box.ValueMember = "id"
            FItem10Box.SelectedIndex = -1

            FItem11Box.DataSource = ds.Tables(0).Copy.DefaultView
            FItem11Box.DisplayMember = "FName"
            FItem11Box.ValueMember = "id"
            FItem11Box.SelectedIndex = -1

            FItem12Box.DataSource = ds.Tables(0).Copy.DefaultView
            FItem12Box.DisplayMember = "FName"
            FItem12Box.ValueMember = "id"
            FItem12Box.SelectedIndex = -1

            FItem13Box.DataSource = ds.Tables(0).Copy.DefaultView
            FItem13Box.DisplayMember = "FName"
            FItem13Box.ValueMember = "id"
            FItem13Box.SelectedIndex = -1

            FItem14Box.DataSource = ds.Tables(0).Copy.DefaultView
            FItem14Box.DisplayMember = "FName"
            FItem14Box.ValueMember = "id"
            FItem14Box.SelectedIndex = -1

            FItem15Box.DataSource = ds.Tables(0).Copy.DefaultView
            FItem15Box.DisplayMember = "FName"
            FItem15Box.ValueMember = "id"
            FItem15Box.SelectedIndex = -1
        Catch ex As Exception
            MsgBox(String.Format("读取项目列表失败!{0}错误信息:{1}", vbCrLf, ex.Message))
            Return
        End Try
    End Sub
#End Region
#Region "按钮点击事件"
    Private Sub FNewBox_Click(sender As Object, e As EventArgs) Handles FNewBox.Click
        NewBill()
    End Sub

    Private Sub FCloseBox_Click(sender As Object, e As EventArgs) Handles FCloseBox.Click
        Dispose()
    End Sub
#End Region

#Region "页面设置"
    Private Sub FPageSetBox_Click(sender As Object, e As EventArgs) Handles FPageSetBox.Click
        '--读取参数
        FControl.PSToPageSettings(PageSetupDialog1, FPInfo)
        '--显示页面设置窗口
        PageSetupDialog1.ShowDialog()
        '--保存参数
        Dim ps As New System.Drawing.Printing.PageSettings
        ps = PageSetupDialog1.PageSettings
        '---------参数赋值
        FPInfo.FMarginB = ps.Margins.Bottom
        FPInfo.FMarginT = ps.Margins.Top
        FPInfo.FMarginR = ps.Margins.Right
        FPInfo.FMarginL = ps.Margins.Left
        If ps.Landscape = False Then
            FPInfo.FPaperDirect = "V"
        Else
            FPInfo.FPaperDirect = "H"
        End If
        FPInfo.FPaperName = ps.PaperSize.PaperName
        FPInfo.FPrinterName = ps.PrinterSettings.PrinterName
        '---上传参数
        Dim ErrString As String = String.Empty
        If SControl._Base_SetBillConfig(UInfo.FSession, "PropertyDown", FPInfo, ErrString) = False Then
            MsgBox(ErrString)
            Return
        End If

    End Sub
#End Region

#Region "保存单据"
    Private Sub FSaveBox_Click(sender As Object, e As EventArgs) Handles FSaveBox.Click
        Try
            Dim ErrString As String = String.Empty
            Select Case FOpenType
                Case "View"
                    '--审核
                    If SControl._BILL_PropDown_SaveBill(UInfo.FSession, FBillInfo, "Verify", ErrString) = False Then
                        MsgBox(ErrString)
                        Return
                    End If
                    '--禁用审核按钮,打开打印按钮
                    FSaveBox.Enabled = False
                    FPrintBox.Enabled = True
                    MsgBox("收费成功!")
                    FSaveBox.Enabled = False
                    FPrintBox.Enabled = True
                    FPNameBox.Text = UInfo.FRName
                Case "New"
                    '--保存
                    '--表头
                    FBillInfo = New BServer.FBillPropDown() With {.FDate = FDateBox.Value, .FCid = FNameBox.SelectedValue, .FName = FNameBox.Text, .FCName = FCNameBox.Text}
                    If FDownBtn.Checked Then
                        FBillInfo.FBType = 0
                    Else
                        FBillInfo.FBType = 1
                    End If
                    FBillInfo.FUid = UInfo.id
                    FBillInfo.FUName = UInfo.FRName
                    FBillInfo.FVid = 0
                    '---分录
                    FBillInfo.FItem1 = FItem1Box.SelectedValue
                    FBillInfo.FItemName1 = FItem1Box.Text
                    FBillInfo.FSDate1 = FSDate1Box.Value
                    FBillInfo.FEDate1 = FEDate1Box.Value
                    FBillInfo.FDays1 = FDays1Box.Value
                    FBillInfo.FQty1 = FQty1Box.Value
                    FBillInfo.FPrice1 = FPrice1Box.Value
                    FBillInfo.FAcc1 = FAcc1Box.Value

                    FBillInfo.FItem2 = FItem2Box.SelectedValue
                    FBillInfo.FItemName2 = FItem2Box.Text
                    FBillInfo.FSDate2 = FSDate2Box.Value
                    FBillInfo.FEDate2 = FEDate2Box.Value
                    FBillInfo.FDays2 = FDays2Box.Value
                    FBillInfo.FQty2 = FQty2Box.Value
                    FBillInfo.FPrice2 = FPrice2Box.Value
                    FBillInfo.FAcc2 = FAcc2Box.Value

                    FBillInfo.FItem3 = FItem3Box.SelectedValue
                    FBillInfo.FItemName3 = FItem3Box.Text
                    FBillInfo.FSDate3 = FSDate3Box.Value
                    FBillInfo.FEDate3 = FEDate3Box.Value
                    FBillInfo.FDays3 = FDays3Box.Value
                    FBillInfo.FQty3 = FQty3Box.Value
                    FBillInfo.FPrice3 = FPrice3Box.Value
                    FBillInfo.FAcc3 = FAcc3Box.Value

                    FBillInfo.FItem4 = FItem4Box.SelectedValue
                    FBillInfo.FItemName4 = FItem4Box.Text
                    FBillInfo.FSDate4 = FSDate4Box.Value
                    FBillInfo.FEDate4 = FEDate4Box.Value
                    FBillInfo.FDays4 = FDays4Box.Value
                    FBillInfo.FQty4 = FQty4Box.Value
                    FBillInfo.FPrice4 = FPrice4Box.Value
                    FBillInfo.FAcc4 = FAcc4Box.Value

                    FBillInfo.FItem5 = FItem5Box.SelectedValue
                    FBillInfo.FItemName5 = FItem5Box.Text
                    FBillInfo.FSDate5 = FSDate5Box.Value
                    FBillInfo.FEDate5 = FEDate5Box.Value
                    FBillInfo.FDays5 = FDays5Box.Value
                    FBillInfo.FQty5 = FQty5Box.Value
                    FBillInfo.FPrice5 = FPrice5Box.Value
                    FBillInfo.FAcc5 = FAcc5Box.Value

                    FBillInfo.FItem6 = FItem6Box.SelectedValue
                    FBillInfo.FItemName6 = FItem6Box.Text
                    FBillInfo.FSDate6 = FSDate6Box.Value
                    FBillInfo.FEDate6 = FEDate6Box.Value
                    FBillInfo.FDays6 = FDays6Box.Value
                    FBillInfo.FQty6 = FQty6Box.Value
                    FBillInfo.FPrice6 = FPrice6Box.Value
                    FBillInfo.FAcc6 = FAcc6Box.Value

                    FBillInfo.FItem7 = FItem7Box.SelectedValue
                    FBillInfo.FItemName7 = FItem7Box.Text
                    FBillInfo.FSDate7 = FSDate7Box.Value
                    FBillInfo.FEDate7 = FEDate7Box.Value
                    FBillInfo.FDays7 = FDays7Box.Value
                    FBillInfo.FQty7 = FQty7Box.Value
                    FBillInfo.FPrice7 = FPrice7Box.Value
                    FBillInfo.FAcc7 = FAcc7Box.Value

                    FBillInfo.FItem8 = FItem8Box.SelectedValue
                    FBillInfo.FItemName8 = FItem8Box.Text
                    FBillInfo.FSDate8 = FSDate8Box.Value
                    FBillInfo.FEDate8 = FEDate8Box.Value
                    FBillInfo.FDays8 = FDays8Box.Value
                    FBillInfo.FQty8 = FQty8Box.Value
                    FBillInfo.FPrice8 = FPrice8Box.Value
                    FBillInfo.FAcc8 = FAcc8Box.Value

                    FBillInfo.FItem9 = FItem9Box.SelectedValue
                    FBillInfo.FItemName9 = FItem9Box.Text
                    FBillInfo.FSDate9 = FSDate9Box.Value
                    FBillInfo.FEDate9 = FEDate9Box.Value
                    FBillInfo.FDays9 = FDays9Box.Value
                    FBillInfo.FQty9 = FQty9Box.Value
                    FBillInfo.FPrice9 = FPrice9Box.Value
                    FBillInfo.FAcc9 = FAcc9Box.Value

                    FBillInfo.FItem10 = FItem10Box.SelectedValue
                    FBillInfo.FItemName10 = FItem10Box.Text
                    FBillInfo.FSDate10 = FSDate10Box.Value
                    FBillInfo.FEDate10 = FEDate10Box.Value
                    FBillInfo.FDays10 = FDays10Box.Value
                    FBillInfo.FQty10 = FQty10Box.Value
                    FBillInfo.FPrice10 = FPrice10Box.Value
                    FBillInfo.FAcc10 = FAcc10Box.Value

                    FBillInfo.FItem11 = FItem11Box.SelectedValue
                    FBillInfo.FItemName11 = FItem11Box.Text
                    FBillInfo.FSDate11 = FSDate11Box.Value
                    FBillInfo.FEDate11 = FEDate11Box.Value
                    FBillInfo.FDays11 = FDays11Box.Value
                    FBillInfo.FQty11 = FQty11Box.Value
                    FBillInfo.FPrice11 = FPrice11Box.Value
                    FBillInfo.FAcc11 = FAcc11Box.Value

                    FBillInfo.FItem12 = FItem12Box.SelectedValue
                    FBillInfo.FItemName12 = FItem12Box.Text
                    FBillInfo.FSDate12 = FSDate12Box.Value
                    FBillInfo.FEDate12 = FEDate12Box.Value
                    FBillInfo.FDays12 = FDays12Box.Value
                    FBillInfo.FQty12 = FQty12Box.Value
                    FBillInfo.FPrice12 = FPrice12Box.Value
                    FBillInfo.FAcc12 = FAcc12Box.Value

                    FBillInfo.FItem13 = FItem13Box.SelectedValue
                    FBillInfo.FItemName13 = FItem13Box.Text
                    FBillInfo.FSDate13 = FSDate13Box.Value
                    FBillInfo.FEDate13 = FEDate13Box.Value
                    FBillInfo.FDays13 = FDays13Box.Value
                    FBillInfo.FQty13 = FQty13Box.Value
                    FBillInfo.FPrice13 = FPrice13Box.Value
                    FBillInfo.FAcc13 = FAcc13Box.Value

                    FBillInfo.FItem14 = FItem14Box.SelectedValue
                    FBillInfo.FItemName14 = FItem14Box.Text
                    FBillInfo.FSDate14 = FSDate14Box.Value
                    FBillInfo.FEDate14 = FEDate14Box.Value
                    FBillInfo.FDays14 = FDays14Box.Value
                    FBillInfo.FQty14 = FQty14Box.Value
                    FBillInfo.FPrice14 = FPrice14Box.Value
                    FBillInfo.FAcc14 = FAcc14Box.Value

                    FBillInfo.FItem15 = FItem15Box.SelectedValue
                    FBillInfo.FItemName15 = FItem15Box.Text
                    FBillInfo.FSDate15 = FSDate15Box.Value
                    FBillInfo.FEDate15 = FEDate15Box.Value
                    FBillInfo.FDays15 = FDays15Box.Value
                    FBillInfo.FQty15 = FQty15Box.Value
                    FBillInfo.FPrice15 = FPrice15Box.Value
                    FBillInfo.FAcc15 = FAcc15Box.Value

                    '--合计数
                    FBillInfo.FAmount = FAmountSMLabel.Text
                    '--保存单据
                    If SControl._BILL_PropDown_SaveBill(UInfo.FSession, FBillInfo, "New", ErrString) = False Then
                        MsgBox(ErrString)
                        FBillInfo = New BServer.FBillPropDown
                        Return
                    End If
                    '--取单号验证码
                    If FBillInfo.id <= 0 Then
                        MsgBox("未知错误!")
                        Return
                    End If
                    If FBillInfo.FBillNo.Trim = String.Empty Then
                        MsgBox("取单据号失败!")
                        Return
                    End If
                    If FBillInfo.FVerifyCode.Trim = String.Empty Then
                        MsgBox("取验证码失败!")
                        Return
                    End If
                    FBillNoBox.Text = FBillInfo.FBillNo
                    FVerifyBox.Text = FBillInfo.FVerifyCode
                    FBillInfo.FOrgName = SControl.Base_Org_getOrgName(FBillInfo.FOrgid)
                    '--切换按钮状态
                    FSaveBox.Enabled = True
                    FSaveBox.Text = "收费"
                    FOpenType = "View"
                    FDisCont(False)
                Case Else
                    MsgBox("参数错误!")
                    Return
            End Select
        Catch ex As Exception
            MsgBox(ex.Message)
            Return
        End Try

    End Sub
#End Region

#Region "点击地上地下radio按钮事件"
    Private Sub FUpBtn_CheckedChanged(sender As Object, e As EventArgs) Handles FUpBtn.CheckedChanged
        If FLoad And FUpBtn.Checked = True Then
            NewBill()
        End If
    End Sub

    Private Sub FDownBtn_CheckedChanged(sender As Object, e As EventArgs) Handles FDownBtn.CheckedChanged
        If FLoad And FDownBtn.Checked = True Then
            NewBill()
        End If
    End Sub
#End Region

#Region "离开项目控件事件"
    Private Sub FItem1Box_Leave(sender As Object, e As EventArgs) Handles FItem1Box.Leave
        Try
            If FOpenType = "View" Then
                Return
            End If
            Dim s As Integer = FItem1Box.FindStringExact(FItem1Box.Text.Trim)
            If s > -1 Then
                '-存在
                Dim FCinf As New BServer.FBasePropDown
                FItem1Box.SelectedIndex = s
                FCinf.id = FItem1Box.SelectedValue
                If SControl._BILL_PropertyDown_GetItemInfo(UInfo.FSession, FCinf, "ITEM", Nothing) = False Then
                    Return
                End If
                FQty1Box.Value = FCinf.FQty
                FPrice1Box.Value = FCinf.FPrice
            End If

        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FItem2Box_Leave(sender As Object, e As EventArgs) Handles FItem2Box.Leave
        Try
            If FOpenType = "View" Then
                Return
            End If
            Dim s As Integer = FItem2Box.FindStringExact(FItem2Box.Text.Trim)
            If s > -1 Then
                '-存在
                Dim FCinf As New BServer.FBasePropDown
                FItem2Box.SelectedIndex = s
                FCinf.id = FItem2Box.SelectedValue
                If SControl._BILL_PropertyDown_GetItemInfo(UInfo.FSession, FCinf, "ITEM", Nothing) = False Then
                    Return
                End If
                FQty2Box.Value = FCinf.FQty
                FPrice2Box.Value = FCinf.FPrice
            End If

        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FItem3Box_Leave(sender As Object, e As EventArgs) Handles FItem3Box.Leave
        Try
            If FOpenType = "View" Then
                Return
            End If
            Dim s As Integer = FItem3Box.FindStringExact(FItem3Box.Text.Trim)
            If s > -1 Then
                '-存在
                Dim FCinf As New BServer.FBasePropDown
                FItem3Box.SelectedIndex = s
                FCinf.id = FItem3Box.SelectedValue
                If SControl._BILL_PropertyDown_GetItemInfo(UInfo.FSession, FCinf, "ITEM", Nothing) = False Then
                    Return
                End If
                FQty3Box.Value = FCinf.FQty
                FPrice3Box.Value = FCinf.FPrice
            End If

        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FItem4Box_Leave(sender As Object, e As EventArgs) Handles FItem4Box.Leave
        Try
            If FOpenType = "View" Then
                Return
            End If
            Dim s As Integer = FItem4Box.FindStringExact(FItem4Box.Text.Trim)
            If s > -1 Then
                '-存在
                Dim FCinf As New BServer.FBasePropDown
                FItem4Box.SelectedIndex = s
                FCinf.id = FItem4Box.SelectedValue
                If SControl._BILL_PropertyDown_GetItemInfo(UInfo.FSession, FCinf, "ITEM", Nothing) = False Then
                    Return
                End If
                FQty4Box.Value = FCinf.FQty
                FPrice4Box.Value = FCinf.FPrice
            End If

        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FItem5Box_Leave(sender As Object, e As EventArgs) Handles FItem5Box.Leave
        Try
            If FOpenType = "View" Then
                Return
            End If
            Dim s As Integer = FItem5Box.FindStringExact(FItem5Box.Text.Trim)
            If s > -1 Then
                '-存在
                Dim FCinf As New BServer.FBasePropDown
                FItem5Box.SelectedIndex = s
                FCinf.id = FItem5Box.SelectedValue
                If SControl._BILL_PropertyDown_GetItemInfo(UInfo.FSession, FCinf, "ITEM", Nothing) = False Then
                    Return
                End If
                FQty5Box.Value = FCinf.FQty
                FPrice5Box.Value = FCinf.FPrice
            End If

        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FItem6Box_Leave(sender As Object, e As EventArgs) Handles FItem6Box.Leave
        Try
            If FOpenType = "View" Then
                Return
            End If
            Dim s As Integer = FItem6Box.FindStringExact(FItem6Box.Text.Trim)
            If s > -1 Then
                '-存在
                Dim FCinf As New BServer.FBasePropDown
                FItem6Box.SelectedIndex = s
                FCinf.id = FItem6Box.SelectedValue
                If FDownBtn.Checked Then
                    '--地下
                    If SControl._BILL_PropertyDown_GetItemInfo(UInfo.FSession, FCinf, "ITEM", Nothing) = False Then
                        Return
                    End If
                    FQty6Box.Value = FCinf.FQty
                    FPrice6Box.Value = FCinf.FPrice
                ElseIf FUpBtn.Checked Then
                    '--地上
                    FSDate6Box.Value = FSDate1Box.Value
                    FEDate6Box.Value = FEDate1Box.Value
                    FDays6Box.Value = FDays1Box.Value
                    FQty6Box.Value = FQty1Box.Value
                    FPrice6Box.Value = FPrice1Box.Value
                Else
                    Return
                End If
            Else
                If FDownBtn.Checked Then
                    '--地下
                ElseIf FUpBtn.Checked And FItem6Box.Text.Trim <> String.Empty Then
                    '--地上
                    FSDate6Box.Value = FSDate1Box.Value
                    FEDate6Box.Value = FEDate1Box.Value
                    FDays6Box.Value = FDays1Box.Value
                    FQty6Box.Value = FQty1Box.Value
                    FPrice6Box.Value = FPrice1Box.Value
                Else
                    Return
                End If
            End If

        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FItem7Box_Leave(sender As Object, e As EventArgs) Handles FItem7Box.Leave
        Try
            If FOpenType = "View" Then
                Return
            End If
            Dim s As Integer = FItem7Box.FindStringExact(FItem7Box.Text.Trim)
            If s > -1 Then
                '-存在
                Dim FCinf As New BServer.FBasePropDown
                FItem7Box.SelectedIndex = s
                FCinf.id = FItem7Box.SelectedValue
                If FDownBtn.Checked Then
                    '--地下
                    If SControl._BILL_PropertyDown_GetItemInfo(UInfo.FSession, FCinf, "ITEM", Nothing) = False Then
                        Return
                    End If
                    FQty7Box.Value = FCinf.FQty
                    FPrice7Box.Value = FCinf.FPrice
                ElseIf FUpBtn.Checked Then
                    '--地上
                    FSDate7Box.Value = FSDate2Box.Value
                    FEDate7Box.Value = FEDate2Box.Value
                    FDays7Box.Value = FDays2Box.Value
                    FQty7Box.Value = FQty2Box.Value
                    FPrice7Box.Value = FPrice2Box.Value
                Else
                    Return
                End If
            Else
                If FDownBtn.Checked Then
                    '--地下
                ElseIf FUpBtn.Checked And FItem7Box.Text.Trim <> String.Empty Then
                    '--地上
                    FSDate7Box.Value = FSDate2Box.Value
                    FEDate7Box.Value = FEDate2Box.Value
                    FDays7Box.Value = FDays2Box.Value
                    FQty7Box.Value = FQty2Box.Value
                    FPrice7Box.Value = FPrice2Box.Value
                Else
                    Return
                End If
            End If

        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FItem8Box_Leave(sender As Object, e As EventArgs) Handles FItem8Box.Leave
        Try
            If FOpenType = "View" Then
                Return
            End If
            Dim s As Integer = FItem8Box.FindStringExact(FItem8Box.Text.Trim)
            If s > -1 Then
                '-存在
                Dim FCinf As New BServer.FBasePropDown
                FItem8Box.SelectedIndex = s
                FCinf.id = FItem8Box.SelectedValue
                If FDownBtn.Checked Then
                    '--地下
                    If SControl._BILL_PropertyDown_GetItemInfo(UInfo.FSession, FCinf, "ITEM", Nothing) = False Then
                        Return
                    End If
                    FQty8Box.Value = FCinf.FQty
                    FPrice8Box.Value = FCinf.FPrice
                ElseIf FUpBtn.Checked Then
                    '--地上
                    FSDate8Box.Value = FSDate3Box.Value
                    FEDate8Box.Value = FEDate3Box.Value
                    FDays8Box.Value = FDays3Box.Value
                    FQty8Box.Value = FQty3Box.Value
                    FPrice8Box.Value = FPrice3Box.Value
                Else
                    Return
                End If
            Else
                If FDownBtn.Checked Then
                    '--地下
                ElseIf FUpBtn.Checked And FItem8Box.Text.Trim <> String.Empty Then
                    '--地上
                    FSDate8Box.Value = FSDate3Box.Value
                    FEDate8Box.Value = FEDate3Box.Value
                    FDays8Box.Value = FDays3Box.Value
                    FQty8Box.Value = FQty3Box.Value
                    FPrice8Box.Value = FPrice3Box.Value
                Else
                    Return
                End If
            End If

        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FItem9Box_Leave(sender As Object, e As EventArgs) Handles FItem9Box.Leave
        Try
            If FOpenType = "View" Then
                Return
            End If
            Dim s As Integer = FItem9Box.FindStringExact(FItem9Box.Text.Trim)
            If s > -1 Then
                '-存在
                Dim FCinf As New BServer.FBasePropDown
                FItem9Box.SelectedIndex = s
                FCinf.id = FItem9Box.SelectedValue
                If FDownBtn.Checked Then
                    '--地下
                    If SControl._BILL_PropertyDown_GetItemInfo(UInfo.FSession, FCinf, "ITEM", Nothing) = False Then
                        Return
                    End If
                    FQty9Box.Value = FCinf.FQty
                    FPrice9Box.Value = FCinf.FPrice
                ElseIf FUpBtn.Checked Then
                    '--地上
                    FSDate9Box.Value = FSDate4Box.Value
                    FEDate9Box.Value = FEDate4Box.Value
                    FDays9Box.Value = FDays4Box.Value
                    FQty9Box.Value = FQty4Box.Value
                    FPrice9Box.Value = FPrice4Box.Value
                Else
                    Return
                End If
            Else
                If FDownBtn.Checked Then
                    '--地下
                ElseIf FUpBtn.Checked And FItem9Box.Text.Trim <> String.Empty Then
                    '--地上
                    FSDate9Box.Value = FSDate4Box.Value
                    FEDate9Box.Value = FEDate4Box.Value
                    FDays9Box.Value = FDays4Box.Value
                    FQty9Box.Value = FQty4Box.Value
                    FPrice9Box.Value = FPrice4Box.Value
                Else
                    Return
                End If
            End If

        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FItem10Box_Leave(sender As Object, e As EventArgs) Handles FItem10Box.Leave
        Try
            If FOpenType = "View" Then
                Return
            End If
            Dim s As Integer = FItem10Box.FindStringExact(FItem10Box.Text.Trim)
            If s > -1 Then
                '-存在
                Dim FCinf As New BServer.FBasePropDown
                FItem10Box.SelectedIndex = s
                FCinf.id = FItem10Box.SelectedValue
                If FDownBtn.Checked Then
                    '--地下
                    If SControl._BILL_PropertyDown_GetItemInfo(UInfo.FSession, FCinf, "ITEM", Nothing) = False Then
                        Return
                    End If
                    FQty10Box.Value = FCinf.FQty
                    FPrice10Box.Value = FCinf.FPrice
                ElseIf FUpBtn.Checked Then
                    '--地上
                    FSDate10Box.Value = FSDate5Box.Value
                    FEDate10Box.Value = FEDate5Box.Value
                    FDays10Box.Value = FDays5Box.Value
                    FQty10Box.Value = FQty5Box.Value
                    FPrice10Box.Value = FPrice5Box.Value
                Else
                    Return
                End If
            Else
                If FDownBtn.Checked Then
                    '--地下
                ElseIf FUpBtn.Checked And FItem10Box.Text.Trim <> String.Empty Then
                    '--地上
                    FSDate10Box.Value = FSDate5Box.Value
                    FEDate10Box.Value = FEDate5Box.Value
                    FDays10Box.Value = FDays5Box.Value
                    FQty10Box.Value = FQty5Box.Value
                    FPrice10Box.Value = FPrice5Box.Value
                Else
                    Return
                End If
            End If

        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FItem11Box_Leave(sender As Object, e As EventArgs) Handles FItem11Box.Leave
        Try
            If FOpenType = "View" Then
                Return
            End If
            Dim s As Integer = FItem11Box.FindStringExact(FItem11Box.Text.Trim)
            If s > -1 Then
                '-存在
                Dim FCinf As New BServer.FBasePropDown
                FItem11Box.SelectedIndex = s
                FCinf.id = FItem11Box.SelectedValue
                If FDownBtn.Checked Then
                    '--地下
                    If SControl._BILL_PropertyDown_GetItemInfo(UInfo.FSession, FCinf, "ITEM", Nothing) = False Then
                        Return
                    End If
                    FQty11Box.Value = FCinf.FQty
                    FPrice11Box.Value = FCinf.FPrice
                ElseIf FUpBtn.Checked Then
                    '--地上
                    FSDate11Box.Value = FSDate1Box.Value
                    FEDate11Box.Value = FEDate1Box.Value
                    FDays11Box.Value = FDays1Box.Value
                    FQty11Box.Value = FQty1Box.Value
                    FPrice11Box.Value = FPrice1Box.Value
                Else
                    Return
                End If
            Else
                If FDownBtn.Checked Then
                    '--地下
                ElseIf FUpBtn.Checked And FItem11Box.Text.Trim <> String.Empty Then
                    '--地上
                    FSDate11Box.Value = FSDate1Box.Value
                    FEDate11Box.Value = FEDate1Box.Value
                    FDays11Box.Value = FDays1Box.Value
                    FQty11Box.Value = FQty1Box.Value
                    FPrice11Box.Value = FPrice1Box.Value
                Else
                    Return
                End If
            End If

        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FItem12Box_Leave(sender As Object, e As EventArgs) Handles FItem12Box.Leave
        Try
            If FOpenType = "View" Then
                Return
            End If
            Dim s As Integer = FItem12Box.FindStringExact(FItem12Box.Text.Trim)
            If s > -1 Then
                '-存在
                Dim FCinf As New BServer.FBasePropDown
                FItem12Box.SelectedIndex = s
                FCinf.id = FItem12Box.SelectedValue
                If FDownBtn.Checked Then
                    '--地下
                    If SControl._BILL_PropertyDown_GetItemInfo(UInfo.FSession, FCinf, "ITEM", Nothing) = False Then
                        Return
                    End If
                    FQty12Box.Value = FCinf.FQty
                    FPrice12Box.Value = FCinf.FPrice
                ElseIf FUpBtn.Checked Then
                    '--地上
                    FSDate12Box.Value = FSDate2Box.Value
                    FEDate12Box.Value = FEDate2Box.Value
                    FDays12Box.Value = FDays2Box.Value
                    FQty12Box.Value = FQty2Box.Value
                    FPrice12Box.Value = FPrice2Box.Value
                Else
                    Return
                End If
            Else
                If FDownBtn.Checked Then
                    '--地下
                ElseIf FUpBtn.Checked And FItem12Box.Text.Trim <> String.Empty Then
                    '--地上
                    FSDate12Box.Value = FSDate2Box.Value
                    FEDate12Box.Value = FEDate2Box.Value
                    FDays12Box.Value = FDays2Box.Value
                    FQty12Box.Value = FQty2Box.Value
                    FPrice12Box.Value = FPrice2Box.Value
                Else
                    Return
                End If
            End If

        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FItem13Box_Leave(sender As Object, e As EventArgs) Handles FItem13Box.Leave
        Try
            If FOpenType = "View" Then
                Return
            End If
            Dim s As Integer = FItem13Box.FindStringExact(FItem13Box.Text.Trim)
            If s > -1 Then
                '-存在
                Dim FCinf As New BServer.FBasePropDown
                FItem13Box.SelectedIndex = s
                FCinf.id = FItem13Box.SelectedValue
                If FDownBtn.Checked Then
                    '--地下
                    If SControl._BILL_PropertyDown_GetItemInfo(UInfo.FSession, FCinf, "ITEM", Nothing) = False Then
                        Return
                    End If
                    FQty13Box.Value = FCinf.FQty
                    FPrice13Box.Value = FCinf.FPrice
                ElseIf FUpBtn.Checked Then
                    '--地上
                    FSDate13Box.Value = FSDate3Box.Value
                    FEDate13Box.Value = FEDate3Box.Value
                    FDays13Box.Value = FDays3Box.Value
                    FQty13Box.Value = FQty3Box.Value
                    FPrice13Box.Value = FPrice3Box.Value
                Else
                    Return
                End If
            Else
                If FDownBtn.Checked Then
                    '--地下
                ElseIf FUpBtn.Checked And FItem13Box.Text.Trim <> String.Empty Then
                    '--地上
                    FSDate13Box.Value = FSDate3Box.Value
                    FEDate13Box.Value = FEDate3Box.Value
                    FDays13Box.Value = FDays3Box.Value
                    FQty13Box.Value = FQty3Box.Value
                    FPrice13Box.Value = FPrice3Box.Value
                Else
                    Return
                End If
            End If

        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FItem14Box_Leave(sender As Object, e As EventArgs) Handles FItem14Box.Leave
        Try
            If FOpenType = "View" Then
                Return
            End If
            Dim s As Integer = FItem14Box.FindStringExact(FItem14Box.Text.Trim)
            If s > -1 Then
                '-存在
                Dim FCinf As New BServer.FBasePropDown
                FItem14Box.SelectedIndex = s
                FCinf.id = FItem14Box.SelectedValue
                If FDownBtn.Checked Then
                    '--地下
                    If SControl._BILL_PropertyDown_GetItemInfo(UInfo.FSession, FCinf, "ITEM", Nothing) = False Then
                        Return
                    End If
                    FQty14Box.Value = FCinf.FQty
                    FPrice14Box.Value = FCinf.FPrice
                ElseIf FUpBtn.Checked Then
                    '--地上
                    FSDate14Box.Value = FSDate4Box.Value
                    FEDate14Box.Value = FEDate4Box.Value
                    FDays14Box.Value = FDays4Box.Value
                    FQty14Box.Value = FQty4Box.Value
                    FPrice14Box.Value = FPrice4Box.Value
                Else
                    Return
                End If
            Else
                If FDownBtn.Checked Then
                    '--地下
                ElseIf FUpBtn.Checked And FItem14Box.Text.Trim <> String.Empty Then
                    '--地上
                    FSDate14Box.Value = FSDate4Box.Value
                    FEDate14Box.Value = FEDate4Box.Value
                    FDays14Box.Value = FDays4Box.Value
                    FQty14Box.Value = FQty4Box.Value
                    FPrice14Box.Value = FPrice4Box.Value
                Else
                    Return
                End If
            End If

        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FItem15Box_Leave(sender As Object, e As EventArgs) Handles FItem15Box.Leave
        Try
            If FOpenType = "View" Then
                Return
            End If
            Dim s As Integer = FItem15Box.FindStringExact(FItem15Box.Text.Trim)
            If s > -1 Then
                '-存在
                Dim FCinf As New BServer.FBasePropDown
                FItem15Box.SelectedIndex = s
                FCinf.id = FItem15Box.SelectedValue
                If FDownBtn.Checked Then
                    '--地下
                    If SControl._BILL_PropertyDown_GetItemInfo(UInfo.FSession, FCinf, "ITEM", Nothing) = False Then
                        Return
                    End If
                    FQty15Box.Value = FCinf.FQty
                    FPrice15Box.Value = FCinf.FPrice
                ElseIf FUpBtn.Checked Then
                    '--地上
                    FSDate15Box.Value = FSDate5Box.Value
                    FEDate15Box.Value = FEDate5Box.Value
                    FDays15Box.Value = FDays5Box.Value
                    FQty15Box.Value = FQty5Box.Value
                    FPrice15Box.Value = FPrice5Box.Value
                Else
                    Return
                End If
            Else
                If FDownBtn.Checked Then
                    '--地下
                ElseIf FUpBtn.Checked And FItem15Box.Text.Trim <> String.Empty Then
                    '--地上
                    FSDate15Box.Value = FSDate5Box.Value
                    FEDate15Box.Value = FEDate5Box.Value
                    FDays15Box.Value = FDays5Box.Value
                    FQty15Box.Value = FQty5Box.Value
                    FPrice15Box.Value = FPrice5Box.Value
                Else
                    Return
                End If
            End If

        Catch ex As Exception
            Return
        End Try
    End Sub
#End Region

#Region "重新下面两个表格进行同步数据"
    Private Sub FSetData()
        Try
            '--地上单据重新指定相关记录
            If FUpBtn.Checked Then
                If FItem6Box.Text.Trim <> String.Empty Then
                    FSDate6Box.Value = FSDate1Box.Value
                    FEDate6Box.Value = FEDate1Box.Value
                    FDays6Box.Value = FDays1Box.Value
                    FQty6Box.Value = FQty1Box.Value
                    FPrice6Box.Value = FPrice1Box.Value
                    FAcc6Box.Value = FAcc1Box.Value
                End If
                If FItem7Box.Text.Trim <> String.Empty Then
                    FSDate7Box.Value = FSDate2Box.Value
                    FEDate7Box.Value = FEDate2Box.Value
                    FDays7Box.Value = FDays2Box.Value
                    FQty7Box.Value = FQty2Box.Value
                    FPrice7Box.Value = FPrice2Box.Value
                    FAcc7Box.Value = FAcc2Box.Value
                End If

                If FItem8Box.Text.Trim <> String.Empty Then
                    FSDate8Box.Value = FSDate3Box.Value
                    FEDate8Box.Value = FEDate3Box.Value
                    FDays8Box.Value = FDays3Box.Value
                    FQty8Box.Value = FQty3Box.Value
                    FPrice8Box.Value = FPrice3Box.Value
                    FAcc8Box.Value = FAcc3Box.Value
                End If

                If FItem9Box.Text.Trim <> String.Empty Then
                    FSDate9Box.Value = FSDate4Box.Value
                    FEDate9Box.Value = FEDate4Box.Value
                    FDays9Box.Value = FDays4Box.Value
                    FQty9Box.Value = FQty4Box.Value
                    FPrice9Box.Value = FPrice4Box.Value
                    FAcc9Box.Value = FAcc4Box.Value
                End If

                If FItem10Box.Text.Trim <> String.Empty Then
                    FSDate10Box.Value = FSDate5Box.Value
                    FEDate10Box.Value = FEDate5Box.Value
                    FDays10Box.Value = FDays5Box.Value
                    FQty10Box.Value = FQty5Box.Value
                    FPrice10Box.Value = FPrice5Box.Value
                    FAcc10Box.Value = FAcc5Box.Value
                End If

                If FItem11Box.Text.Trim <> String.Empty Then
                    FSDate11Box.Value = FSDate1Box.Value
                    FEDate11Box.Value = FEDate1Box.Value
                    FDays11Box.Value = FDays1Box.Value
                    FQty11Box.Value = FQty1Box.Value
                    FPrice11Box.Value = FPrice1Box.Value
                    FAcc11Box.Value = FAcc1Box.Value
                End If

                If FItem12Box.Text.Trim <> String.Empty Then
                    FSDate12Box.Value = FSDate2Box.Value
                    FEDate12Box.Value = FEDate2Box.Value
                    FDays12Box.Value = FDays2Box.Value
                    FQty12Box.Value = FQty2Box.Value
                    FPrice12Box.Value = FPrice2Box.Value
                    FAcc12Box.Value = FAcc2Box.Value
                End If

                If FItem13Box.Text.Trim <> String.Empty Then
                    FSDate13Box.Value = FSDate3Box.Value
                    FEDate13Box.Value = FEDate3Box.Value
                    FDays13Box.Value = FDays3Box.Value
                    FQty13Box.Value = FQty3Box.Value
                    FPrice13Box.Value = FPrice3Box.Value
                    FAcc13Box.Value = FAcc3Box.Value
                End If

                If FItem14Box.Text.Trim <> String.Empty Then
                    FSDate14Box.Value = FSDate4Box.Value
                    FEDate14Box.Value = FEDate4Box.Value
                    FDays14Box.Value = FDays4Box.Value
                    FQty14Box.Value = FQty4Box.Value
                    FPrice14Box.Value = FPrice4Box.Value
                    FAcc14Box.Value = FAcc4Box.Value
                End If

                If FItem15Box.Text.Trim <> String.Empty Then
                    FSDate15Box.Value = FSDate5Box.Value
                    FEDate15Box.Value = FEDate5Box.Value
                    FDays15Box.Value = FDays5Box.Value
                    FQty15Box.Value = FQty5Box.Value
                    FPrice15Box.Value = FPrice5Box.Value
                    FAcc15Box.Value = FAcc5Box.Value
                End If

            End If
        Catch ex As Exception
            Return
        End Try

    End Sub
#End Region

#Region "起始,结束日期选择事件"
    Private Sub FSDate1Box_ValueChanged(sender As Object, e As EventArgs) Handles FSDate1Box.ValueChanged
        If FOpenType = "View" Then
            Return
        End If
        If FSDate1Box.Value = Nothing Or FEDate1Box.Value = Nothing Then
            Return
        End If
        Try
            FDays1Box.Value = 1 + Math.Abs(DateDiff(DateInterval.Day, FSDate1Box.Value.Date, FEDate1Box.Value.Date))
        Catch ex As Exception
            Return
        End Try
        FSetData()

    End Sub

    Private Sub FEDate1Box_ValueChanged(sender As Object, e As EventArgs) Handles FEDate1Box.ValueChanged
        If FOpenType = "View" Then
            Return
        End If
        If FSDate1Box.Value = Nothing Or FEDate1Box.Value = Nothing Then
            Return
        End If
        Try
            FDays1Box.Value = 1 + Math.Abs(DateDiff(DateInterval.Day, FSDate1Box.Value.Date, FEDate1Box.Value.Date))
        Catch ex As Exception
            Return
        End Try
        FSetData()
    End Sub


    Private Sub FSDate2Box_ValueChanged(sender As Object, e As EventArgs) Handles FSDate2Box.ValueChanged
        If FOpenType = "View" Then
            Return
        End If
        If FSDate2Box.Value = Nothing Or FEDate2Box.Value = Nothing Then
            Return
        End If
        Try
            FDays2Box.Value = 1 + Math.Abs(DateDiff(DateInterval.Day, FSDate2Box.Value.Date, FEDate2Box.Value.Date))
        Catch ex As Exception
            Return
        End Try
        FSetData()
    End Sub

    Private Sub FEDate2Box_ValueChanged(sender As Object, e As EventArgs) Handles FEDate2Box.ValueChanged
        If FOpenType = "View" Then
            Return
        End If
        If FSDate2Box.Value = Nothing Or FEDate2Box.Value = Nothing Then
            Return
        End If
        Try
            FDays2Box.Value = 1 + Math.Abs(DateDiff(DateInterval.Day, FSDate2Box.Value.Date, FEDate2Box.Value.Date))
        Catch ex As Exception
            Return
        End Try
        FSetData()
    End Sub


    Private Sub FSDate3Box_ValueChanged(sender As Object, e As EventArgs) Handles FSDate3Box.ValueChanged
        If FOpenType = "View" Then
            Return
        End If
        If FSDate3Box.Value = Nothing Or FEDate3Box.Value = Nothing Then
            Return
        End If
        Try
            FDays3Box.Value = 1 + Math.Abs(DateDiff(DateInterval.Day, FSDate3Box.Value.Date, FEDate3Box.Value.Date))
        Catch ex As Exception
            Return
        End Try
        FSetData()
    End Sub

    Private Sub FEDate3Box_ValueChanged(sender As Object, e As EventArgs) Handles FEDate3Box.ValueChanged
        If FOpenType = "View" Then
            Return
        End If
        If FSDate3Box.Value = Nothing Or FEDate3Box.Value = Nothing Then
            Return
        End If
        Try
            FDays3Box.Value = 1 + Math.Abs(DateDiff(DateInterval.Day, FSDate3Box.Value.Date, FEDate3Box.Value.Date))
        Catch ex As Exception
            Return
        End Try
        FSetData()
    End Sub


    Private Sub FSDate4Box_ValueChanged(sender As Object, e As EventArgs) Handles FSDate4Box.ValueChanged
        If FOpenType = "View" Then
            Return
        End If
        If FSDate4Box.Value = Nothing Or FEDate4Box.Value = Nothing Then
            Return
        End If
        Try
            FDays4Box.Value = 1 + Math.Abs(DateDiff(DateInterval.Day, FSDate4Box.Value.Date, FEDate4Box.Value.Date))
        Catch ex As Exception
            Return
        End Try
        FSetData()
    End Sub

    Private Sub FEDate4Box_ValueChanged(sender As Object, e As EventArgs) Handles FEDate4Box.ValueChanged
        If FOpenType = "View" Then
            Return
        End If
        If FSDate4Box.Value = Nothing Or FEDate4Box.Value = Nothing Then
            Return
        End If
        Try
            FDays4Box.Value = 1 + Math.Abs(DateDiff(DateInterval.Day, FSDate4Box.Value.Date, FEDate4Box.Value.Date))
        Catch ex As Exception
            Return
        End Try
        FSetData()
    End Sub


    Private Sub FSDate5Box_ValueChanged(sender As Object, e As EventArgs) Handles FSDate5Box.ValueChanged
        If FOpenType = "View" Then
            Return
        End If
        If FSDate5Box.Value = Nothing Or FEDate5Box.Value = Nothing Then
            Return
        End If
        Try
            FDays5Box.Value = 1 + Math.Abs(DateDiff(DateInterval.Day, FSDate5Box.Value.Date, FEDate5Box.Value.Date))
        Catch ex As Exception
            Return
        End Try
        FSetData()
    End Sub

    Private Sub FEDate5Box_ValueChanged(sender As Object, e As EventArgs) Handles FEDate5Box.ValueChanged
        If FOpenType = "View" Then
            Return
        End If
        If FSDate5Box.Value = Nothing Or FEDate5Box.Value = Nothing Then
            Return
        End If
        Try
            FDays5Box.Value = 1 + Math.Abs(DateDiff(DateInterval.Day, FSDate5Box.Value.Date, FEDate5Box.Value.Date))
        Catch ex As Exception
            Return
        End Try
        FSetData()
    End Sub


    Private Sub FSDate6Box_ValueChanged(sender As Object, e As EventArgs) Handles FSDate6Box.ValueChanged
        If FOpenType = "View" Then
            Return
        End If
        If FSDate6Box.Value = Nothing Or FEDate6Box.Value = Nothing Then
            Return
        End If
        Try
            FDays6Box.Value = 1 + Math.Abs(DateDiff(DateInterval.Day, FSDate6Box.Value.Date, FEDate6Box.Value.Date))
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FEDate6Box_ValueChanged(sender As Object, e As EventArgs) Handles FEDate6Box.ValueChanged
        If FOpenType = "View" Then
            Return
        End If
        If FSDate6Box.Value = Nothing Or FEDate6Box.Value = Nothing Then
            Return
        End If
        Try
            FDays6Box.Value = 1 + Math.Abs(DateDiff(DateInterval.Day, FSDate6Box.Value.Date, FEDate6Box.Value.Date))
        Catch ex As Exception
            Return
        End Try
    End Sub


    Private Sub FSDate7Box_ValueChanged(sender As Object, e As EventArgs) Handles FSDate7Box.ValueChanged
        If FOpenType = "View" Then
            Return
        End If
        If FSDate7Box.Value = Nothing Or FEDate7Box.Value = Nothing Then
            Return
        End If
        Try
            FDays7Box.Value = 1 + Math.Abs(DateDiff(DateInterval.Day, FSDate7Box.Value.Date, FEDate7Box.Value.Date))
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FEDate7Box_ValueChanged(sender As Object, e As EventArgs) Handles FEDate7Box.ValueChanged
        If FOpenType = "View" Then
            Return
        End If
        If FSDate7Box.Value = Nothing Or FEDate7Box.Value = Nothing Then
            Return
        End If
        Try
            FDays7Box.Value = 1 + Math.Abs(DateDiff(DateInterval.Day, FSDate7Box.Value.Date, FEDate7Box.Value.Date))
        Catch ex As Exception
            Return
        End Try
    End Sub


    Private Sub FSDate8Box_ValueChanged(sender As Object, e As EventArgs) Handles FSDate8Box.ValueChanged
        If FOpenType = "View" Then
            Return
        End If
        If FSDate8Box.Value = Nothing Or FEDate8Box.Value = Nothing Then
            Return
        End If
        Try
            FDays8Box.Value = 1 + Math.Abs(DateDiff(DateInterval.Day, FSDate8Box.Value.Date, FEDate8Box.Value.Date))
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FEDate8Box_ValueChanged(sender As Object, e As EventArgs) Handles FEDate8Box.ValueChanged
        If FOpenType = "View" Then
            Return
        End If
        If FSDate8Box.Value = Nothing Or FEDate8Box.Value = Nothing Then
            Return
        End If
        Try
            FDays8Box.Value = 1 + Math.Abs(DateDiff(DateInterval.Day, FSDate8Box.Value.Date, FEDate8Box.Value.Date))
        Catch ex As Exception
            Return
        End Try
    End Sub


    Private Sub FSDate9Box_ValueChanged(sender As Object, e As EventArgs) Handles FSDate9Box.ValueChanged
        If FOpenType = "View" Then
            Return
        End If
        If FSDate9Box.Value = Nothing Or FEDate9Box.Value = Nothing Then
            Return
        End If
        Try
            FDays9Box.Value = 1 + Math.Abs(DateDiff(DateInterval.Day, FSDate9Box.Value.Date, FEDate9Box.Value.Date))
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FEDate9Box_ValueChanged(sender As Object, e As EventArgs) Handles FEDate9Box.ValueChanged
        If FOpenType = "View" Then
            Return
        End If
        If FSDate9Box.Value = Nothing Or FEDate9Box.Value = Nothing Then
            Return
        End If
        Try
            FDays9Box.Value = 1 + Math.Abs(DateDiff(DateInterval.Day, FSDate9Box.Value.Date, FEDate9Box.Value.Date))
        Catch ex As Exception
            Return
        End Try
    End Sub


    Private Sub FSDate10Box_ValueChanged(sender As Object, e As EventArgs) Handles FSDate10Box.ValueChanged
        If FOpenType = "View" Then
            Return
        End If
        If FSDate10Box.Value = Nothing Or FEDate10Box.Value = Nothing Then
            Return
        End If
        Try
            FDays10Box.Value = 1 + Math.Abs(DateDiff(DateInterval.Day, FSDate10Box.Value.Date, FEDate10Box.Value.Date))
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FEDate10Box_ValueChanged(sender As Object, e As EventArgs) Handles FEDate10Box.ValueChanged
        If FOpenType = "View" Then
            Return
        End If
        If FSDate10Box.Value = Nothing Or FEDate10Box.Value = Nothing Then
            Return
        End If
        Try
            FDays10Box.Value = 1 + Math.Abs(DateDiff(DateInterval.Day, FSDate10Box.Value.Date, FEDate10Box.Value.Date))
        Catch ex As Exception
            Return
        End Try
    End Sub


    Private Sub FSDate11Box_ValueChanged(sender As Object, e As EventArgs) Handles FSDate11Box.ValueChanged
        If FOpenType = "View" Then
            Return
        End If
        If FSDate11Box.Value = Nothing Or FEDate11Box.Value = Nothing Then
            Return
        End If
        Try
            FDays11Box.Value = 1 + Math.Abs(DateDiff(DateInterval.Day, FSDate11Box.Value.Date, FEDate11Box.Value.Date))
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FEDate11Box_ValueChanged(sender As Object, e As EventArgs) Handles FEDate11Box.ValueChanged
        If FOpenType = "View" Then
            Return
        End If
        If FSDate11Box.Value = Nothing Or FEDate11Box.Value = Nothing Then
            Return
        End If
        Try
            FDays11Box.Value = 1 + Math.Abs(DateDiff(DateInterval.Day, FSDate11Box.Value.Date, FEDate11Box.Value.Date))
        Catch ex As Exception
            Return
        End Try
    End Sub


    Private Sub FSDate12Box_ValueChanged(sender As Object, e As EventArgs) Handles FSDate12Box.ValueChanged
        If FOpenType = "View" Then
            Return
        End If
        If FSDate12Box.Value = Nothing Or FEDate12Box.Value = Nothing Then
            Return
        End If
        Try
            FDays12Box.Value = 1 + Math.Abs(DateDiff(DateInterval.Day, FSDate12Box.Value.Date, FEDate12Box.Value.Date))
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FEDate12Box_ValueChanged(sender As Object, e As EventArgs) Handles FEDate12Box.ValueChanged
        If FOpenType = "View" Then
            Return
        End If
        If FSDate12Box.Value = Nothing Or FEDate12Box.Value = Nothing Then
            Return
        End If
        Try
            FDays12Box.Value = 1 + Math.Abs(DateDiff(DateInterval.Day, FSDate12Box.Value.Date, FEDate12Box.Value.Date))
        Catch ex As Exception
            Return
        End Try
    End Sub


    Private Sub FSDate13Box_ValueChanged(sender As Object, e As EventArgs) Handles FSDate13Box.ValueChanged
        If FOpenType = "View" Then
            Return
        End If
        If FSDate13Box.Value = Nothing Or FEDate13Box.Value = Nothing Then
            Return
        End If
        Try
            FDays13Box.Value = 1 + Math.Abs(DateDiff(DateInterval.Day, FSDate13Box.Value.Date, FEDate13Box.Value.Date))
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FEDate13Box_ValueChanged(sender As Object, e As EventArgs) Handles FEDate13Box.ValueChanged
        If FOpenType = "View" Then
            Return
        End If
        If FSDate13Box.Value = Nothing Or FEDate13Box.Value = Nothing Then
            Return
        End If
        Try
            FDays13Box.Value = 1 + Math.Abs(DateDiff(DateInterval.Day, FSDate13Box.Value.Date, FEDate13Box.Value.Date))
        Catch ex As Exception
            Return
        End Try
    End Sub


    Private Sub FSDate14Box_ValueChanged(sender As Object, e As EventArgs) Handles FSDate14Box.ValueChanged
        If FOpenType = "View" Then
            Return
        End If
        If FSDate14Box.Value = Nothing Or FEDate14Box.Value = Nothing Then
            Return
        End If
        Try
            FDays14Box.Value = 1 + Math.Abs(DateDiff(DateInterval.Day, FSDate14Box.Value.Date, FEDate14Box.Value.Date))
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FEDate14Box_ValueChanged(sender As Object, e As EventArgs) Handles FEDate14Box.ValueChanged
        If FOpenType = "View" Then
            Return
        End If
        If FSDate14Box.Value = Nothing Or FEDate14Box.Value = Nothing Then
            Return
        End If
        Try
            FDays14Box.Value = 1 + Math.Abs(DateDiff(DateInterval.Day, FSDate14Box.Value.Date, FEDate14Box.Value.Date))
        Catch ex As Exception
            Return
        End Try
    End Sub


    Private Sub FSDate15Box_ValueChanged(sender As Object, e As EventArgs) Handles FSDate15Box.ValueChanged
        If FOpenType = "View" Then
            Return
        End If
        If FSDate15Box.Value = Nothing Or FEDate15Box.Value = Nothing Then
            Return
        End If
        Try
            FDays15Box.Value = 1 + Math.Abs(DateDiff(DateInterval.Day, FSDate15Box.Value.Date, FEDate15Box.Value.Date))
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FEDate15Box_ValueChanged(sender As Object, e As EventArgs) Handles FEDate15Box.ValueChanged
        If FOpenType = "View" Then
            Return
        End If
        If FSDate15Box.Value = Nothing Or FEDate15Box.Value = Nothing Then
            Return
        End If
        Try
            FDays15Box.Value = 1 + Math.Abs(DateDiff(DateInterval.Day, FSDate15Box.Value.Date, FEDate15Box.Value.Date))
        Catch ex As Exception
            Return
        End Try
    End Sub
#End Region

#Region "计算单据金额事件"
    Private Sub FQty1Box_ValueChanged(sender As Object, e As EventArgs) Handles FQty1Box.ValueChanged
        Try
            FAcc1Box.Value = FQty1Box.Value * FPrice1Box.Value * FDays1Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
        FSetData()
    End Sub

    Private Sub FPrice1Box_ValueChanged(sender As Object, e As EventArgs) Handles FPrice1Box.ValueChanged
        Try
            FAcc1Box.Value = FQty1Box.Value * FPrice1Box.Value * FDays1Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
        FSetData()
    End Sub

    Private Sub FDays1Box_ValueChanged(sender As Object, e As EventArgs) Handles FDays1Box.ValueChanged
        Try
            FAcc1Box.Value = FQty1Box.Value * FPrice1Box.Value * FDays1Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
        FSetData()
    End Sub

    Private Sub FAcc1Box_ValueChanged(sender As Object, e As EventArgs) Handles FAcc1Box.ValueChanged
        Try
            FAm1label.Text = FAcc1Box.Value + FAcc2Box.Value + FAcc3Box.Value + FAcc4Box.Value + FAcc5Box.Value
            FAm2label.Text = FAcc6Box.Value + FAcc7Box.Value + FAcc8Box.Value + FAcc9Box.Value + FAcc10Box.Value
            FAm3Label.Text = FAcc11Box.Value + FAcc12Box.Value + FAcc13Box.Value + FAcc14Box.Value + FAcc15Box.Value
            FAmountSMLabel.Text = Math.Round(CDbl(FAm1label.Text) + CDbl(FAm2label.Text) + CDbl(FAm3Label.Text), System.MidpointRounding.AwayFromZero)
            FAmountBGLabel.Text = FControl.MoneyToUpper(CDbl(FAmountSMLabel.Text))
        Catch ex As Exception
            Return
        End Try
        FSetData()
    End Sub


    Private Sub FQty2Box_ValueChanged(sender As Object, e As EventArgs) Handles FQty2Box.ValueChanged
        Try
            FAcc2Box.Value = FQty2Box.Value * FPrice2Box.Value * FDays2Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
        FSetData()
    End Sub
    Private Sub FPrice2Box_ValueChanged(sender As Object, e As EventArgs) Handles FPrice2Box.ValueChanged
        Try
            FAcc2Box.Value = FQty2Box.Value * FPrice2Box.Value * FDays2Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
        FSetData()
    End Sub

    Private Sub FDays2Box_ValueChanged(sender As Object, e As EventArgs) Handles FDays2Box.ValueChanged
        Try
            FAcc2Box.Value = FQty2Box.Value * FPrice2Box.Value * FDays2Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
        FSetData()
    End Sub

    Private Sub FAcc2Box_ValueChanged(sender As Object, e As EventArgs) Handles FAcc2Box.ValueChanged
        Try
            FAm1label.Text = FAcc1Box.Value + FAcc2Box.Value + FAcc3Box.Value + FAcc4Box.Value + FAcc5Box.Value
            FAm2label.Text = FAcc6Box.Value + FAcc7Box.Value + FAcc8Box.Value + FAcc9Box.Value + FAcc10Box.Value
            FAm3label.Text = FAcc11Box.Value + FAcc12Box.Value + FAcc13Box.Value + FAcc14Box.Value + FAcc15Box.Value
            FAmountSMLabel.Text = Math.Round(CDbl(FAm1label.Text) + CDbl(FAm2label.Text) + CDbl(FAm3Label.Text), System.MidpointRounding.AwayFromZero)
            FAmountBGLabel.Text = FControl.MoneyToUpper(CDbl(FAmountSMLabel.Text))
        Catch ex As Exception
            Return
        End Try
        FSetData()
    End Sub


    Private Sub FQty3Box_ValueChanged(sender As Object, e As EventArgs) Handles FQty3Box.ValueChanged
        Try
            FAcc3Box.Value = FQty3Box.Value * FPrice3Box.Value * FDays3Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
        FSetData()
    End Sub

    Private Sub FPrice3Box_ValueChanged(sender As Object, e As EventArgs) Handles FPrice3Box.ValueChanged
        Try
            FAcc3Box.Value = FQty3Box.Value * FPrice3Box.Value * FDays3Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
        FSetData()
    End Sub

    Private Sub FDays3Box_ValueChanged(sender As Object, e As EventArgs) Handles FDays3Box.ValueChanged
        Try
            FAcc3Box.Value = FQty3Box.Value * FPrice3Box.Value * FDays3Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
        FSetData()
    End Sub

    Private Sub FAcc3Box_ValueChanged(sender As Object, e As EventArgs) Handles FAcc3Box.ValueChanged
        Try
            FAm1label.Text = FAcc1Box.Value + FAcc2Box.Value + FAcc3Box.Value + FAcc4Box.Value + FAcc5Box.Value
            FAm2label.Text = FAcc6Box.Value + FAcc7Box.Value + FAcc8Box.Value + FAcc9Box.Value + FAcc10Box.Value
            FAm3label.Text = FAcc11Box.Value + FAcc12Box.Value + FAcc13Box.Value + FAcc14Box.Value + FAcc15Box.Value
            FAmountSMLabel.Text = Math.Round(CDbl(FAm1label.Text) + CDbl(FAm2label.Text) + CDbl(FAm3Label.Text), System.MidpointRounding.AwayFromZero)
            FAmountBGLabel.Text = FControl.MoneyToUpper(CDbl(FAmountSMLabel.Text))
        Catch ex As Exception
            Return
        End Try
        FSetData()
    End Sub


    Private Sub FQty4Box_ValueChanged(sender As Object, e As EventArgs) Handles FQty4Box.ValueChanged
        Try
            FAcc4Box.Value = FQty4Box.Value * FPrice4Box.Value * FDays4Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
        FSetData()
    End Sub

    Private Sub FPrice4Box_ValueChanged(sender As Object, e As EventArgs) Handles FPrice4Box.ValueChanged
        Try
            FAcc4Box.Value = FQty4Box.Value * FPrice4Box.Value * FDays4Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
        FSetData()
    End Sub

    Private Sub FDays4Box_ValueChanged(sender As Object, e As EventArgs) Handles FDays4Box.ValueChanged
        Try
            FAcc4Box.Value = FQty4Box.Value * FPrice4Box.Value * FDays4Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
        FSetData()
    End Sub

    Private Sub FAcc4Box_ValueChanged(sender As Object, e As EventArgs) Handles FAcc4Box.ValueChanged
        Try
            FAm1label.Text = FAcc1Box.Value + FAcc2Box.Value + FAcc3Box.Value + FAcc4Box.Value + FAcc5Box.Value
            FAm2label.Text = FAcc6Box.Value + FAcc7Box.Value + FAcc8Box.Value + FAcc9Box.Value + FAcc10Box.Value
            FAm3label.Text = FAcc11Box.Value + FAcc12Box.Value + FAcc13Box.Value + FAcc14Box.Value + FAcc15Box.Value
            FAmountSMLabel.Text = Math.Round(CDbl(FAm1label.Text) + CDbl(FAm2label.Text) + CDbl(FAm3Label.Text), System.MidpointRounding.AwayFromZero)
            FAmountBGLabel.Text = FControl.MoneyToUpper(CDbl(FAmountSMLabel.Text))
        Catch ex As Exception
            Return
        End Try
        FSetData()
    End Sub


    Private Sub FQty5Box_ValueChanged(sender As Object, e As EventArgs) Handles FQty5Box.ValueChanged
        Try
            FAcc5Box.Value = FQty5Box.Value * FPrice5Box.Value * FDays5Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
        FSetData()
    End Sub

    Private Sub FPrice5Box_ValueChanged(sender As Object, e As EventArgs) Handles FPrice5Box.ValueChanged
        Try
            FAcc5Box.Value = FQty5Box.Value * FPrice5Box.Value * FDays5Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
        FSetData()
    End Sub

    Private Sub FDays5Box_ValueChanged(sender As Object, e As EventArgs) Handles FDays5Box.ValueChanged
        Try
            FAcc5Box.Value = FQty5Box.Value * FPrice5Box.Value * FDays5Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
        FSetData()
    End Sub

    Private Sub FAcc5Box_ValueChanged(sender As Object, e As EventArgs) Handles FAcc5Box.ValueChanged
        Try
            FAm1label.Text = FAcc1Box.Value + FAcc2Box.Value + FAcc3Box.Value + FAcc4Box.Value + FAcc5Box.Value
            FAm2label.Text = FAcc6Box.Value + FAcc7Box.Value + FAcc8Box.Value + FAcc9Box.Value + FAcc10Box.Value
            FAm3label.Text = FAcc11Box.Value + FAcc12Box.Value + FAcc13Box.Value + FAcc14Box.Value + FAcc15Box.Value
            FAmountSMLabel.Text = Math.Round(CDbl(FAm1label.Text) + CDbl(FAm2label.Text) + CDbl(FAm3Label.Text), System.MidpointRounding.AwayFromZero)
            FAmountBGLabel.Text = FControl.MoneyToUpper(CDbl(FAmountSMLabel.Text))
        Catch ex As Exception
            Return
        End Try
        FSetData()
    End Sub


    Private Sub FQty6Box_ValueChanged(sender As Object, e As EventArgs) Handles FQty6Box.ValueChanged
        Try
            FAcc6Box.Value = FQty6Box.Value * FPrice6Box.Value * FDays6Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FPrice6Box_ValueChanged(sender As Object, e As EventArgs) Handles FPrice6Box.ValueChanged
        Try
            FAcc6Box.Value = FQty6Box.Value * FPrice6Box.Value * FDays6Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FDays6Box_ValueChanged(sender As Object, e As EventArgs) Handles FDays6Box.ValueChanged
        Try
            FAcc6Box.Value = FQty6Box.Value * FPrice6Box.Value * FDays6Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FAcc6Box_ValueChanged(sender As Object, e As EventArgs) Handles FAcc6Box.ValueChanged
        Try
            FAm1label.Text = FAcc1Box.Value + FAcc2Box.Value + FAcc3Box.Value + FAcc4Box.Value + FAcc5Box.Value
            FAm2label.Text = FAcc6Box.Value + FAcc7Box.Value + FAcc8Box.Value + FAcc9Box.Value + FAcc10Box.Value
            FAm3label.Text = FAcc11Box.Value + FAcc12Box.Value + FAcc13Box.Value + FAcc14Box.Value + FAcc15Box.Value
            FAmountSMLabel.Text = Math.Round(CDbl(FAm1label.Text) + CDbl(FAm2label.Text) + CDbl(FAm3Label.Text), System.MidpointRounding.AwayFromZero)
            FAmountBGLabel.Text = FControl.MoneyToUpper(CDbl(FAmountSMLabel.Text))
        Catch ex As Exception
            Return
        End Try
    End Sub


    Private Sub FQty7Box_ValueChanged(sender As Object, e As EventArgs) Handles FQty7Box.ValueChanged
        Try
            FAcc7Box.Value = FQty7Box.Value * FPrice7Box.Value * FDays7Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FPrice7Box_ValueChanged(sender As Object, e As EventArgs) Handles FPrice7Box.ValueChanged
        Try
            FAcc7Box.Value = FQty7Box.Value * FPrice7Box.Value * FDays7Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FDays7Box_ValueChanged(sender As Object, e As EventArgs) Handles FDays7Box.ValueChanged
        Try
            FAcc7Box.Value = FQty7Box.Value * FPrice7Box.Value * FDays7Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FAcc7Box_ValueChanged(sender As Object, e As EventArgs) Handles FAcc7Box.ValueChanged
        Try
            FAm1label.Text = FAcc1Box.Value + FAcc2Box.Value + FAcc3Box.Value + FAcc4Box.Value + FAcc5Box.Value
            FAm2label.Text = FAcc6Box.Value + FAcc7Box.Value + FAcc8Box.Value + FAcc9Box.Value + FAcc10Box.Value
            FAm3label.Text = FAcc11Box.Value + FAcc12Box.Value + FAcc13Box.Value + FAcc14Box.Value + FAcc15Box.Value
            FAmountSMLabel.Text = Math.Round(CDbl(FAm1label.Text) + CDbl(FAm2label.Text) + CDbl(FAm3Label.Text), System.MidpointRounding.AwayFromZero)
            FAmountBGLabel.Text = FControl.MoneyToUpper(CDbl(FAmountSMLabel.Text))
        Catch ex As Exception
            Return
        End Try
    End Sub


    Private Sub FQty8Box_ValueChanged(sender As Object, e As EventArgs) Handles FQty8Box.ValueChanged
        Try
            FAcc8Box.Value = FQty8Box.Value * FPrice8Box.Value * FDays8Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FPrice8Box_ValueChanged(sender As Object, e As EventArgs) Handles FPrice8Box.ValueChanged
        Try
            FAcc8Box.Value = FQty8Box.Value * FPrice8Box.Value * FDays8Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FDays8Box_ValueChanged(sender As Object, e As EventArgs) Handles FDays8Box.ValueChanged
        Try
            FAcc8Box.Value = FQty8Box.Value * FPrice8Box.Value * FDays8Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FAcc8Box_ValueChanged(sender As Object, e As EventArgs) Handles FAcc8Box.ValueChanged
        Try
            FAm1label.Text = FAcc1Box.Value + FAcc2Box.Value + FAcc3Box.Value + FAcc4Box.Value + FAcc5Box.Value
            FAm2label.Text = FAcc6Box.Value + FAcc7Box.Value + FAcc8Box.Value + FAcc9Box.Value + FAcc10Box.Value
            FAm3label.Text = FAcc11Box.Value + FAcc12Box.Value + FAcc13Box.Value + FAcc14Box.Value + FAcc15Box.Value
            FAmountSMLabel.Text = Math.Round(CDbl(FAm1label.Text) + CDbl(FAm2label.Text) + CDbl(FAm3Label.Text), System.MidpointRounding.AwayFromZero)
            FAmountBGLabel.Text = FControl.MoneyToUpper(CDbl(FAmountSMLabel.Text))
        Catch ex As Exception
            Return
        End Try
    End Sub


    Private Sub FQty9Box_ValueChanged(sender As Object, e As EventArgs) Handles FQty9Box.ValueChanged
        Try
            FAcc9Box.Value = FQty9Box.Value * FPrice9Box.Value * FDays9Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FPrice9Box_ValueChanged(sender As Object, e As EventArgs) Handles FPrice9Box.ValueChanged
        Try
            FAcc9Box.Value = FQty9Box.Value * FPrice9Box.Value * FDays9Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FDays9Box_ValueChanged(sender As Object, e As EventArgs) Handles FDays9Box.ValueChanged
        Try
            FAcc9Box.Value = FQty9Box.Value * FPrice9Box.Value * FDays9Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FAcc9Box_ValueChanged(sender As Object, e As EventArgs) Handles FAcc9Box.ValueChanged
        Try
            FAm1label.Text = FAcc1Box.Value + FAcc2Box.Value + FAcc3Box.Value + FAcc4Box.Value + FAcc5Box.Value
            FAm2label.Text = FAcc6Box.Value + FAcc7Box.Value + FAcc8Box.Value + FAcc9Box.Value + FAcc10Box.Value
            FAm3label.Text = FAcc11Box.Value + FAcc12Box.Value + FAcc13Box.Value + FAcc14Box.Value + FAcc15Box.Value
            FAmountSMLabel.Text = Math.Round(CDbl(FAm1label.Text) + CDbl(FAm2label.Text) + CDbl(FAm3Label.Text), System.MidpointRounding.AwayFromZero)
            FAmountBGLabel.Text = FControl.MoneyToUpper(CDbl(FAmountSMLabel.Text))
        Catch ex As Exception
            Return
        End Try
    End Sub


    Private Sub FQty10Box_ValueChanged(sender As Object, e As EventArgs) Handles FQty10Box.ValueChanged
        Try
            FAcc10Box.Value = FQty10Box.Value * FPrice10Box.Value * FDays10Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FPrice10Box_ValueChanged(sender As Object, e As EventArgs) Handles FPrice10Box.ValueChanged
        Try
            FAcc10Box.Value = FQty10Box.Value * FPrice10Box.Value * FDays10Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FDays10Box_ValueChanged(sender As Object, e As EventArgs) Handles FDays10Box.ValueChanged
        Try
            FAcc10Box.Value = FQty10Box.Value * FPrice10Box.Value * FDays10Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FAcc10Box_ValueChanged(sender As Object, e As EventArgs) Handles FAcc10Box.ValueChanged
        Try
            FAm1label.Text = FAcc1Box.Value + FAcc2Box.Value + FAcc3Box.Value + FAcc4Box.Value + FAcc5Box.Value
            FAm2label.Text = FAcc6Box.Value + FAcc7Box.Value + FAcc8Box.Value + FAcc9Box.Value + FAcc10Box.Value
            FAm3label.Text = FAcc11Box.Value + FAcc12Box.Value + FAcc13Box.Value + FAcc14Box.Value + FAcc15Box.Value
            FAmountSMLabel.Text = Math.Round(CDbl(FAm1label.Text) + CDbl(FAm2label.Text) + CDbl(FAm3Label.Text), System.MidpointRounding.AwayFromZero)
            FAmountBGLabel.Text = FControl.MoneyToUpper(CDbl(FAmountSMLabel.Text))
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FQty11Box_ValueChanged(sender As Object, e As EventArgs) Handles FQty11Box.ValueChanged
        Try
            FAcc11Box.Value = FQty11Box.Value * FPrice11Box.Value * FDays11Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FPrice11Box_ValueChanged(sender As Object, e As EventArgs) Handles FPrice11Box.ValueChanged
        Try
            FAcc11Box.Value = FQty11Box.Value * FPrice11Box.Value * FDays11Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FDays11Box_ValueChanged(sender As Object, e As EventArgs) Handles FDays11Box.ValueChanged
        Try
            FAcc11Box.Value = FQty11Box.Value * FPrice11Box.Value * FDays11Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FAcc11Box_ValueChanged(sender As Object, e As EventArgs) Handles FAcc11Box.ValueChanged
        Try
            FAm1label.Text = FAcc1Box.Value + FAcc2Box.Value + FAcc3Box.Value + FAcc4Box.Value + FAcc5Box.Value
            FAm2label.Text = FAcc6Box.Value + FAcc7Box.Value + FAcc8Box.Value + FAcc9Box.Value + FAcc10Box.Value
            FAm3label.Text = FAcc11Box.Value + FAcc12Box.Value + FAcc13Box.Value + FAcc14Box.Value + FAcc15Box.Value
            FAmountSMLabel.Text = Math.Round(CDbl(FAm1label.Text) + CDbl(FAm2label.Text) + CDbl(FAm3Label.Text), System.MidpointRounding.AwayFromZero)
            FAmountBGLabel.Text = FControl.MoneyToUpper(CDbl(FAmountSMLabel.Text))
        Catch ex As Exception
            Return
        End Try
    End Sub


    Private Sub FQty12Box_ValueChanged(sender As Object, e As EventArgs) Handles FQty12Box.ValueChanged
        Try
            FAcc12Box.Value = FQty12Box.Value * FPrice12Box.Value * FDays12Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FPrice12Box_ValueChanged(sender As Object, e As EventArgs) Handles FPrice12Box.ValueChanged
        Try
            FAcc12Box.Value = FQty12Box.Value * FPrice12Box.Value * FDays12Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FDays12Box_ValueChanged(sender As Object, e As EventArgs) Handles FDays12Box.ValueChanged
        Try
            FAcc12Box.Value = FQty12Box.Value * FPrice12Box.Value * FDays12Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FAcc12Box_ValueChanged(sender As Object, e As EventArgs) Handles FAcc12Box.ValueChanged
        Try
            FAm1label.Text = FAcc1Box.Value + FAcc2Box.Value + FAcc3Box.Value + FAcc4Box.Value + FAcc5Box.Value
            FAm2label.Text = FAcc6Box.Value + FAcc7Box.Value + FAcc8Box.Value + FAcc9Box.Value + FAcc10Box.Value
            FAm3label.Text = FAcc11Box.Value + FAcc12Box.Value + FAcc13Box.Value + FAcc14Box.Value + FAcc15Box.Value
            FAmountSMLabel.Text = Math.Round(CDbl(FAm1label.Text) + CDbl(FAm2label.Text) + CDbl(FAm3Label.Text), System.MidpointRounding.AwayFromZero)
            FAmountBGLabel.Text = FControl.MoneyToUpper(CDbl(FAmountSMLabel.Text))
        Catch ex As Exception
            Return
        End Try
    End Sub


    Private Sub FPrice13Box_ValueChanged(sender As Object, e As EventArgs) Handles FPrice13Box.ValueChanged
        Try
            FAcc13Box.Value = FQty13Box.Value * FPrice13Box.Value * FDays13Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FQty13Box_ValueChanged(sender As Object, e As EventArgs) Handles FQty13Box.ValueChanged
        Try
            FAcc13Box.Value = FQty13Box.Value * FPrice13Box.Value * FDays13Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FDays13Box_ValueChanged(sender As Object, e As EventArgs) Handles FDays13Box.ValueChanged
        Try
            FAcc13Box.Value = FQty13Box.Value * FPrice13Box.Value * FDays13Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FAcc13Box_ValueChanged(sender As Object, e As EventArgs) Handles FAcc13Box.ValueChanged
        Try
            FAm1label.Text = FAcc1Box.Value + FAcc2Box.Value + FAcc3Box.Value + FAcc4Box.Value + FAcc5Box.Value
            FAm2label.Text = FAcc6Box.Value + FAcc7Box.Value + FAcc8Box.Value + FAcc9Box.Value + FAcc10Box.Value
            FAm3label.Text = FAcc11Box.Value + FAcc12Box.Value + FAcc13Box.Value + FAcc14Box.Value + FAcc15Box.Value
            FAmountSMLabel.Text = Math.Round(CDbl(FAm1label.Text) + CDbl(FAm2label.Text) + CDbl(FAm3Label.Text), System.MidpointRounding.AwayFromZero)
            FAmountBGLabel.Text = FControl.MoneyToUpper(CDbl(FAmountSMLabel.Text))
        Catch ex As Exception
            Return
        End Try
    End Sub


    Private Sub FPrice14Box_ValueChanged(sender As Object, e As EventArgs) Handles FPrice14Box.ValueChanged
        Try
            FAcc14Box.Value = FQty14Box.Value * FPrice14Box.Value * FDays14Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FQty14Box_ValueChanged(sender As Object, e As EventArgs) Handles FQty14Box.ValueChanged
        Try
            FAcc14Box.Value = FQty14Box.Value * FPrice14Box.Value * FDays14Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FDays14Box_ValueChanged(sender As Object, e As EventArgs) Handles FDays14Box.ValueChanged
        Try
            FAcc14Box.Value = FQty14Box.Value * FPrice14Box.Value * FDays14Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FAcc14Box_ValueChanged(sender As Object, e As EventArgs) Handles FAcc14Box.ValueChanged
        Try
            FAm1label.Text = FAcc1Box.Value + FAcc2Box.Value + FAcc3Box.Value + FAcc4Box.Value + FAcc5Box.Value
            FAm2label.Text = FAcc6Box.Value + FAcc7Box.Value + FAcc8Box.Value + FAcc9Box.Value + FAcc10Box.Value
            FAm3label.Text = FAcc11Box.Value + FAcc12Box.Value + FAcc13Box.Value + FAcc14Box.Value + FAcc15Box.Value
            FAmountSMLabel.Text = Math.Round(CDbl(FAm1label.Text) + CDbl(FAm2label.Text) + CDbl(FAm3Label.Text), System.MidpointRounding.AwayFromZero)
            FAmountBGLabel.Text = FControl.MoneyToUpper(CDbl(FAmountSMLabel.Text))
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FQty15Box_ValueChanged(sender As Object, e As EventArgs) Handles FQty15Box.ValueChanged
        Try
            FAcc15Box.Value = FQty15Box.Value * FPrice15Box.Value * FDays15Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FPrice15Box_ValueChanged(sender As Object, e As EventArgs) Handles FPrice15Box.ValueChanged
        Try
            FAcc15Box.Value = FQty15Box.Value * FPrice15Box.Value * FDays15Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FDays15Box_ValueChanged(sender As Object, e As EventArgs) Handles FDays15Box.ValueChanged
        Try
            FAcc15Box.Value = FQty15Box.Value * FPrice15Box.Value * FDays15Box.Value
            '--总金额
        Catch ex As Exception
            Return
        End Try
    End Sub

    Private Sub FAcc15Box_ValueChanged(sender As Object, e As EventArgs) Handles FAcc15Box.ValueChanged
        Try
            FAm1label.Text = FAcc1Box.Value + FAcc2Box.Value + FAcc3Box.Value + FAcc4Box.Value + FAcc5Box.Value
            FAm2label.Text = FAcc6Box.Value + FAcc7Box.Value + FAcc8Box.Value + FAcc9Box.Value + FAcc10Box.Value
            FAm3label.Text = FAcc11Box.Value + FAcc12Box.Value + FAcc13Box.Value + FAcc14Box.Value + FAcc15Box.Value
            FAmountSMLabel.Text = Math.Round(CDbl(FAm1label.Text) + CDbl(FAm2label.Text) + CDbl(FAm3Label.Text), System.MidpointRounding.AwayFromZero)
            FAmountBGLabel.Text = FControl.MoneyToUpper(CDbl(FAmountSMLabel.Text))
        Catch ex As Exception
            Return
        End Try
    End Sub



#End Region

#Region "打印单据"
    Private Sub FPrintBox_Click(sender As Object, e As EventArgs) Handles FPrintBox.Click

        '--读取打印参数
        FControl.PSToPageSettings(PageSetupDialog1, FPInfo)
        Dim ps As New System.Drawing.Printing.PageSettings
        ps = PageSetupDialog1.PageSettings
        PrintDialog1.PrinterSettings = ps.PrinterSettings
        '--弹出打印设置窗口
        If PrintDialog1.ShowDialog() = Windows.Forms.DialogResult.Cancel Then
            Return
        End If
        '--更新打印参数
        PrintDialog1.AllowPrintToFile = False
        ps.PrinterSettings = PrintDialog1.PrinterSettings
        '--保存打印参数
        FPInfo.FPaperName = ps.PaperSize.PaperName
        FPInfo.FPrinterName = ps.PrinterSettings.PrinterName
        '---上传参数
        Dim ErrString As String = String.Empty
        If SControl._Base_SetBillConfig(UInfo.FSession, "PropertyDown", FPInfo, ErrString) = False Then
            MsgBox(ErrString)
            Return
        End If
        '--增加打印次数
        If SControl._BILL_PropertyDown_AddPrintCount(UInfo.FSession, FBillInfo.id, FBillInfo.FPCount, ErrString) = False Then
            MsgBox(ErrString)
            Return
        End If
        FPCountLabel.Text = "打印次数:" & FBillInfo.FPCount
        '---显示预览
        PrintDocument1.DefaultPageSettings = ps
        PrintDocument1.DocumentName = FCaptionLabel.Text
        PrintPreviewDialog1.Document = PrintDocument1
        PrintPreviewDialog1.ShowDialog()
        '--增加打印次数
    End Sub

    Private Sub PrintDocument1_PrintPage(sender As Object, e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
        Try
            '--设置页面参数
            '--A4纸
            PrintDocument1.DefaultPageSettings.PaperSize = New System.Drawing.Printing.PaperSize With {.PaperName = "A4", .Height = 1169, .Width = 827}
            '--页面设置
            PrintDocument1.DefaultPageSettings = PageSetupDialog1.PageSettings
            '--打印机设置
            PrintDocument1.PrinterSettings = PrintDialog1.PrinterSettings
            PrintDocument1.PrinterSettings.Copies = 4
            '--设置以毫米为单位
            e.Graphics.PageUnit = GraphicsUnit.Millimeter

            '--定义变量
            Dim FNT1 As Font = New Font("宋体", 11)
            Dim g As Graphics = e.Graphics 'graphics对象
            Dim FX As Integer = PrintDocument1.DefaultPageSettings.Margins.Left  '横向偏移量
            Dim FY As Integer = PrintDocument1.DefaultPageSettings.Margins.Top  '纵向偏移量
            Dim FNT As New Font("宋体", 20)
            '--打印标题
            g.DrawString(FCaptionLabel.Text, FNT, Brushes.Black, New Point With {.X = 77 + FX, .Y = 0 + FY})
            '--标题下两条线
            g.PageUnit = GraphicsUnit.Display
            g.DrawLine(New Pen(Brushes.Black, 4), FControl.CalcInch(75 + FX), FControl.CalcInch(8 + FY), FControl.CalcInch(140 + FX), FControl.CalcInch(8 + FY))
            g.DrawLine(New Pen(Brushes.Black, 1), FControl.CalcInch(75 + FX), FControl.CalcInch(9 + FY), FControl.CalcInch(140 + FX), FControl.CalcInch(9 + FY))
            '--日期
            e.Graphics.PageUnit = GraphicsUnit.Millimeter
            FNT = New Font("宋体", 12)
            g.DrawString("开票日期:" & FDateBox.Value.ToString("yyyy年MM月dd日"), FNT, Brushes.Black, New PointF With {.X = 80 + FX, .Y = 10 + FY})
            '--交款单位,编号
            g.DrawString("交款单位:" & FNameBox.Text, FNT, Brushes.Black, New PointF(20 + FX, 15 + FY))
            g.DrawString("编    号:" & FBillNoBox.Text, FNT, Brushes.Black, New PointF(135 + FX, 15 + FY))
            '--交款人,验证码
            g.DrawString("交 款 人:" & FCNameBox.Text.Trim, FNT, Brushes.Black, New Point(20 + FX, 22 + FY))
            g.DrawString("验 证 码:" & FVerifyBox.Text.Trim, FNT, Brushes.Black, New Point(135 + FX, 22 + FY))
            '--外框和格线
            g.PageUnit = GraphicsUnit.Display
            Dim rect As New Rectangle(New Point(FControl.CalcInch(19 + FX), FControl.CalcInch(28 + FY)), New Size(FControl.CalcInch(164), FControl.CalcInch(49.2)))
            g.DrawRectangle(Pens.Black, rect)
            g.DrawLine(Pens.Black, FControl.CalcInch(19 + FX), FControl.CalcInch(35 + FY), FControl.CalcInch(183 + FX), FControl.CalcInch(35 + FY))
            g.DrawLine(Pens.Black, FControl.CalcInch(19 + FX), FControl.CalcInch(42 + FY), FControl.CalcInch(183 + FX), FControl.CalcInch(42 + FY))
            g.DrawLine(Pens.Black, FControl.CalcInch(19 + FX), FControl.CalcInch(49 + FY), FControl.CalcInch(183 + FX), FControl.CalcInch(49 + FY))
            g.DrawLine(Pens.Black, FControl.CalcInch(19 + FX), FControl.CalcInch(56 + FY), FControl.CalcInch(183 + FX), FControl.CalcInch(56 + FY))
            g.DrawLine(Pens.Black, FControl.CalcInch(19 + FX), FControl.CalcInch(63 + FY), FControl.CalcInch(183 + FX), FControl.CalcInch(63 + FY))
            g.DrawLine(Pens.Black, FControl.CalcInch(19 + FX), FControl.CalcInch(70 + FY), FControl.CalcInch(183 + FX), FControl.CalcInch(70 + FY))
            '-竖线
            g.DrawLine(Pens.Black, FControl.CalcInch(49 + FX), FControl.CalcInch(28 + FY), FControl.CalcInch(49 + FX), FControl.CalcInch(77 + FY))
            g.DrawLine(Pens.Black, FControl.CalcInch(92 + FX), FControl.CalcInch(28 + FY), FControl.CalcInch(92 + FX), FControl.CalcInch(70 + FY))
            g.DrawLine(Pens.Black, FControl.CalcInch(111 + FX), FControl.CalcInch(28 + FY), FControl.CalcInch(111 + FX), FControl.CalcInch(70 + FY))
            g.DrawLine(Pens.Black, FControl.CalcInch(131 + FX), FControl.CalcInch(28 + FY), FControl.CalcInch(131 + FX), FControl.CalcInch(77 + FY))
            g.DrawLine(Pens.Black, FControl.CalcInch(155 + FX), FControl.CalcInch(28 + FY), FControl.CalcInch(155 + FX), FControl.CalcInch(77 + FY))
            '--标题栏
            g.PageUnit = GraphicsUnit.Millimeter
            FNT = New Font("宋体", 12)
            '-右侧记账联标志
            'g.DrawString("①", FNT, Brushes.Black, New PointF With {.X = 185 + FX, .Y = 39 + FY})
            'g.DrawString("记", FNT, Brushes.Black, New PointF With {.X = 185 + FX, .Y = 45 + FY})
            'g.DrawString("账", FNT, Brushes.Black, New PointF With {.X = 185 + FX, .Y = 50 + FY})
            'g.DrawString("联", FNT, Brushes.Black, New PointF With {.X = 185 + FX, .Y = 55 + FY})
            '-项目
            g.DrawString("项目", FNT, Brushes.Black, New PointF With {.X = 30 + FX, .Y = 30 + FY})
            '-收费区间
            g.DrawString("收费区间", FNT, Brushes.Black, New PointF With {.X = 62 + FX, .Y = 30 + FY})
            '-平米数
            g.DrawString("平米数", FNT, Brushes.Black, New PointF With {.X = 95 + FX, .Y = 30 + FY})
            '-单价
            g.DrawString("元/天.平", FNT, Brushes.Black, New PointF With {.X = 112 + FX, .Y = 30 + FY})
            '-天数
            g.DrawString("天数", FNT, Brushes.Black, New PointF With {.X = 139 + FX, .Y = 30 + FY})
            '-金额
            g.DrawString("金额", FNT, Brushes.Black, New PointF With {.X = 165 + FX, .Y = 30 + FY})
            '-----分录
            '--第一行
            '-项目
            If Not FItem1Box.Text Is Nothing Then
                If FItem1Box.Text.Trim <> String.Empty Then
                    g.DrawString(FItem1Box.Text.Trim, FNT, Brushes.Black, New PointF With {.X = 20 + FX, .Y = 36.5 + FY})
                    '-收费区间

                    g.DrawString(String.Format("{0:yyyy.M.d}-{1:yyyy.M.d}", FSDate1Box.Value, FEDate1Box.Value), FNT1, Brushes.Black, New PointF With {.X = 50 + FX, .Y = 36.5 + FY})
                    '-平米数
                    g.DrawString(FQty1Box.Value, FNT, Brushes.Black, New PointF With {.X = 92 + FX, .Y = 36.5 + FY})
                    '-单价
                    g.DrawString(FPrice1Box.Value, FNT, Brushes.Black, New PointF With {.X = 112 + FX, .Y = 36.5 + FY})
                    '-天数
                    g.DrawString(FDays1Box.Value, FNT, Brushes.Black, New PointF With {.X = 132 + FX, .Y = 36.5 + FY})
                    '-金额
                    g.DrawString(FAcc1Box.Value, FNT, Brushes.Black, New PointF With {.X = 156 + FX, .Y = 36.5 + FY})
                End If
            End If


            '--第二行
            If Not FItem2Box.Text Is Nothing Then
                If FItem2Box.Text.Trim <> String.Empty Then
                    '-项目
                    g.DrawString(FItem2Box.Text.Trim, FNT, Brushes.Black, New PointF With {.X = 20 + FX, .Y = 43.5 + FY})
                    '-收费区间
                    g.DrawString(String.Format("{0:yyyy.M.d}-{1:yyyy.M.d}", FSDate2Box.Value, FEDate2Box.Value), FNT1, Brushes.Black, New PointF With {.X = 50 + FX, .Y = 43.5 + FY})
                    '-平米数
                    g.DrawString(FQty2Box.Value, FNT, Brushes.Black, New PointF With {.X = 92 + FX, .Y = 43.5 + FY})
                    '-单价
                    g.DrawString(FPrice2Box.Value, FNT, Brushes.Black, New PointF With {.X = 112 + FX, .Y = 43.5 + FY})
                    '-天数
                    g.DrawString(FDays2Box.Value, FNT, Brushes.Black, New PointF With {.X = 132 + FX, .Y = 43.5 + FY})
                    '-金额
                    g.DrawString(FAcc2Box.Value, FNT, Brushes.Black, New PointF With {.X = 156 + FX, .Y = 43.5 + FY})

                End If
            End If


            '--第三行
            '-项目
            If Not FItem3Box.Text Is Nothing Then
                If FItem3Box.Text.Trim <> String.Empty Then
                    g.DrawString(FItem3Box.Text.Trim, FNT, Brushes.Black, New PointF With {.X = 20 + FX, .Y = 50.5 + FY})
                    '-收费区间
                    g.DrawString(String.Format("{0:yyyy.M.d}-{1:yyyy.M.d}", FSDate3Box.Value, FEDate3Box.Value), FNT1, Brushes.Black, New PointF With {.X = 50 + FX, .Y = 50.5 + FY})
                    '-平米数
                    g.DrawString(FQty3Box.Value, FNT, Brushes.Black, New PointF With {.X = 92 + FX, .Y = 50.5 + FY})
                    '-单价
                    g.DrawString(FPrice3Box.Value, FNT, Brushes.Black, New PointF With {.X = 112 + FX, .Y = 50.5 + FY})
                    '-天数
                    g.DrawString(FDays3Box.Value, FNT, Brushes.Black, New PointF With {.X = 132 + FX, .Y = 50.5 + FY})
                    '-金额
                    g.DrawString(FAcc3Box.Value, FNT, Brushes.Black, New PointF With {.X = 156 + FX, .Y = 50.5 + FY})
                End If
            End If


            '--第四行
            If Not FItem4Box.Text Is Nothing Then
                If FItem4Box.Text.Trim <> String.Empty Then
                    g.DrawString(FItem4Box.Text.Trim, FNT, Brushes.Black, New PointF With {.X = 20 + FX, .Y = 57.5 + FY})
                    '-收费区间
                    g.DrawString(String.Format("{0:yyyy.M.d}-{1:yyyy.M.d}", FSDate4Box.Value, FEDate4Box.Value), FNT1, Brushes.Black, New PointF With {.X = 50 + FX, .Y = 57.5 + FY})
                    '-平米数
                    g.DrawString(FQty4Box.Value, FNT, Brushes.Black, New PointF With {.X = 92 + FX, .Y = 57.5 + FY})
                    '-单价
                    g.DrawString(FPrice4Box.Value, FNT, Brushes.Black, New PointF With {.X = 112 + FX, .Y = 57.5 + FY})
                    '-天数
                    g.DrawString(FDays4Box.Value, FNT, Brushes.Black, New PointF With {.X = 132 + FX, .Y = 57.5 + FY})
                    '-金额
                    g.DrawString(FAcc4Box.Value, FNT, Brushes.Black, New PointF With {.X = 156 + FX, .Y = 57.5 + FY})

                End If
            End If

            '--第五行
            If Not FItem5Box.Text Is Nothing Then
                If FItem5Box.Text.Trim <> String.Empty Then
                    g.DrawString(FItem5Box.Text.Trim, FNT, Brushes.Black, New PointF With {.X = 20 + FX, .Y = 64.5 + FY})
                    '-收费区间
                    g.DrawString(String.Format("{0:yyyy.M.d}-{1:yyyy.M.d}", FSDate5Box.Value, FEDate5Box.Value), FNT1, Brushes.Black, New PointF With {.X = 50 + FX, .Y = 64.5 + FY})
                    '-平米数
                    g.DrawString(FQty5Box.Value, FNT, Brushes.Black, New PointF With {.X = 92 + FX, .Y = 64.5 + FY})
                    '-单价
                    g.DrawString(FPrice5Box.Value, FNT, Brushes.Black, New PointF With {.X = 112 + FX, .Y = 64.5 + FY})
                    '-天数
                    g.DrawString(FDays5Box.Value, FNT, Brushes.Black, New PointF With {.X = 132 + FX, .Y = 64.5 + FY})
                    '-金额
                    g.DrawString(FAcc5Box.Value, FNT, Brushes.Black, New PointF With {.X = 156 + FX, .Y = 64.5 + FY})

                End If
            End If

            '--合计行
            g.DrawString("合计(大写):", FNT, Brushes.Black, New PointF With {.X = 20 + FX, .Y = 71.5 + FY})
            g.DrawString(FControl.MoneyToUpper(CDbl(FAm1label.Text)), FNT, Brushes.Black, New PointF With {.X = 50 + FX, .Y = 71.5 + FY})
            g.DrawString("合计:", FNT, Brushes.Black, New PointF With {.X = 132 + FX, .Y = 71.5 + FY})
            g.DrawString(FAm1label.Text, FNT, Brushes.Black, New PointF With {.X = 156 + FX, .Y = 71.5 + FY})
            '--表尾信息
            g.DrawString(String.Format("收款人签章:             开票人:{0}   收款单位:昌图县百格物业有限公司", FUNameBox.Text), FNT, Brushes.Black, New PointF With {.X = 20 + FX, .Y = 79 + FY})
            '---------------------------------------------第一段结束--------------------------------------------------
            FY += 97

            FNT = New Font("宋体", 20)
            '--打印标题
            g.DrawString(FCaptionLabel.Text, FNT, Brushes.Black, New Point With {.X = 77 + FX, .Y = 0 + FY})
            '--标题下两条线
            g.PageUnit = GraphicsUnit.Display
            g.DrawLine(New Pen(Brushes.Black, 4), FControl.CalcInch(75 + FX), FControl.CalcInch(8 + FY), FControl.CalcInch(140 + FX), FControl.CalcInch(8 + FY))
            g.DrawLine(New Pen(Brushes.Black, 1), FControl.CalcInch(75 + FX), FControl.CalcInch(9 + FY), FControl.CalcInch(140 + FX), FControl.CalcInch(9 + FY))
            '--日期
            e.Graphics.PageUnit = GraphicsUnit.Millimeter
            FNT = New Font("宋体", 12)
            g.DrawString("开票日期:" & FDateBox.Value.ToString("yyyy年MM月dd日"), FNT, Brushes.Black, New PointF With {.X = 80 + FX, .Y = 10 + FY})
            '--交款单位,编号
            g.DrawString("交款单位:" & FNameBox.Text, FNT, Brushes.Black, New PointF(20 + FX, 15 + FY))
            g.DrawString("编    号:" & FBillNoBox.Text, FNT, Brushes.Black, New PointF(135 + FX, 15 + FY))
            '--交款人,验证码
            g.DrawString("交 款 人:" & FCNameBox.Text.Trim, FNT, Brushes.Black, New Point(20 + FX, 22 + FY))
            g.DrawString("验 证 码:" & FVerifyBox.Text.Trim, FNT, Brushes.Black, New Point(135 + FX, 22 + FY))
            '--外框和格线
            g.PageUnit = GraphicsUnit.Display
            rect = New Rectangle(New Point(FControl.CalcInch(19 + FX), FControl.CalcInch(28 + FY)), New Size(FControl.CalcInch(164), FControl.CalcInch(49.2)))
            g.DrawRectangle(Pens.Black, rect)
            g.DrawLine(Pens.Black, FControl.CalcInch(19 + FX), FControl.CalcInch(35 + FY), FControl.CalcInch(183 + FX), FControl.CalcInch(35 + FY))
            g.DrawLine(Pens.Black, FControl.CalcInch(19 + FX), FControl.CalcInch(42 + FY), FControl.CalcInch(183 + FX), FControl.CalcInch(42 + FY))
            g.DrawLine(Pens.Black, FControl.CalcInch(19 + FX), FControl.CalcInch(49 + FY), FControl.CalcInch(183 + FX), FControl.CalcInch(49 + FY))
            g.DrawLine(Pens.Black, FControl.CalcInch(19 + FX), FControl.CalcInch(56 + FY), FControl.CalcInch(183 + FX), FControl.CalcInch(56 + FY))
            g.DrawLine(Pens.Black, FControl.CalcInch(19 + FX), FControl.CalcInch(63 + FY), FControl.CalcInch(183 + FX), FControl.CalcInch(63 + FY))
            g.DrawLine(Pens.Black, FControl.CalcInch(19 + FX), FControl.CalcInch(70 + FY), FControl.CalcInch(183 + FX), FControl.CalcInch(70 + FY))
            '-竖线
            g.DrawLine(Pens.Black, FControl.CalcInch(49 + FX), FControl.CalcInch(28 + FY), FControl.CalcInch(49 + FX), FControl.CalcInch(77 + FY))
            g.DrawLine(Pens.Black, FControl.CalcInch(92 + FX), FControl.CalcInch(28 + FY), FControl.CalcInch(92 + FX), FControl.CalcInch(70 + FY))
            g.DrawLine(Pens.Black, FControl.CalcInch(111 + FX), FControl.CalcInch(28 + FY), FControl.CalcInch(111 + FX), FControl.CalcInch(70 + FY))
            g.DrawLine(Pens.Black, FControl.CalcInch(131 + FX), FControl.CalcInch(28 + FY), FControl.CalcInch(131 + FX), FControl.CalcInch(77 + FY))
            g.DrawLine(Pens.Black, FControl.CalcInch(155 + FX), FControl.CalcInch(28 + FY), FControl.CalcInch(155 + FX), FControl.CalcInch(77 + FY))
            '--标题栏
            g.PageUnit = GraphicsUnit.Millimeter
            FNT = New Font("宋体", 12)
            '-右侧记账联标志
            'g.DrawString("②", FNT, Brushes.Black, New PointF With {.X = 185 + FX, .Y = 39 + FY})
            'g.DrawString("客", FNT, Brushes.Black, New PointF With {.X = 185 + FX, .Y = 45 + FY})
            'g.DrawString("户", FNT, Brushes.Black, New PointF With {.X = 185 + FX, .Y = 50 + FY})
            'g.DrawString("联", FNT, Brushes.Black, New PointF With {.X = 185 + FX, .Y = 55 + FY})
            '-项目
            g.DrawString("项目", FNT, Brushes.Black, New PointF With {.X = 30 + FX, .Y = 30 + FY})
            '-收费区间
            g.DrawString("收费区间", FNT, Brushes.Black, New PointF With {.X = 62 + FX, .Y = 30 + FY})
            '-平米数
            g.DrawString("平米数", FNT, Brushes.Black, New PointF With {.X = 95 + FX, .Y = 30 + FY})
            '-单价
            g.DrawString("元/天.平", FNT, Brushes.Black, New PointF With {.X = 112 + FX, .Y = 30 + FY})
            '-天数
            g.DrawString("天数", FNT, Brushes.Black, New PointF With {.X = 139 + FX, .Y = 30 + FY})
            '-金额
            g.DrawString("金额", FNT, Brushes.Black, New PointF With {.X = 165 + FX, .Y = 30 + FY})
            '-----分录
            '--第一行
            '-项目
            If Not FItem6Box.Text Is Nothing Then
                If FItem6Box.Text.Trim <> String.Empty Then
                    g.DrawString(FItem6Box.Text.Trim, FNT, Brushes.Black, New PointF With {.X = 20 + FX, .Y = 36.5 + FY})
                    '-收费区间
                    g.DrawString(String.Format("{0:yyyy.M.d}-{1:yyyy.M.d}", FSDate6Box.Value, FEDate6Box.Value), FNT1, Brushes.Black, New PointF With {.X = 50 + FX, .Y = 36.5 + FY})
                    '-平米数
                    g.DrawString(FQty6Box.Value, FNT, Brushes.Black, New PointF With {.X = 92 + FX, .Y = 36.5 + FY})
                    '-单价
                    g.DrawString(FPrice6Box.Value, FNT, Brushes.Black, New PointF With {.X = 112 + FX, .Y = 36.5 + FY})
                    '-天数
                    g.DrawString(FDays6Box.Value, FNT, Brushes.Black, New PointF With {.X = 132 + FX, .Y = 36.5 + FY})
                    '-金额
                    g.DrawString(FAcc6Box.Value, FNT, Brushes.Black, New PointF With {.X = 156 + FX, .Y = 36.5 + FY})
                End If
            End If


            '--第二行
            If Not FItem7Box.Text Is Nothing Then
                If FItem7Box.Text.Trim <> String.Empty Then
                    '-项目
                    g.DrawString(FItem7Box.Text.Trim, FNT, Brushes.Black, New PointF With {.X = 20 + FX, .Y = 43.5 + FY})
                    '-收费区间
                    g.DrawString(String.Format("{0:yyyy.M.d}-{1:yyyy.M.d}", FSDate7Box.Value, FEDate7Box.Value), FNT1, Brushes.Black, New PointF With {.X = 50 + FX, .Y = 43.5 + FY})
                    '-平米数
                    g.DrawString(FQty7Box.Value, FNT, Brushes.Black, New PointF With {.X = 92 + FX, .Y = 43.5 + FY})
                    '-单价
                    g.DrawString(FPrice7Box.Value, FNT, Brushes.Black, New PointF With {.X = 112 + FX, .Y = 43.5 + FY})
                    '-天数
                    g.DrawString(FDays7Box.Value, FNT, Brushes.Black, New PointF With {.X = 132 + FX, .Y = 43.5 + FY})
                    '-金额
                    g.DrawString(FAcc7Box.Value, FNT, Brushes.Black, New PointF With {.X = 156 + FX, .Y = 43.5 + FY})

                End If
            End If


            '--第三行
            '-项目
            If Not FItem8Box.Text Is Nothing Then
                If FItem8Box.Text.Trim <> String.Empty Then
                    g.DrawString(FItem8Box.Text.Trim, FNT, Brushes.Black, New PointF With {.X = 20 + FX, .Y = 50.5 + FY})
                    '-收费区间
                    g.DrawString(String.Format("{0:yyyy.M.d}-{1:yyyy.M.d}", FSDate8Box.Value, FEDate8Box.Value), FNT1, Brushes.Black, New PointF With {.X = 50 + FX, .Y = 50.5 + FY})
                    '-平米数
                    g.DrawString(FQty8Box.Value, FNT, Brushes.Black, New PointF With {.X = 92 + FX, .Y = 50.5 + FY})
                    '-单价
                    g.DrawString(FPrice8Box.Value, FNT, Brushes.Black, New PointF With {.X = 112 + FX, .Y = 50.5 + FY})
                    '-天数
                    g.DrawString(FDays8Box.Value, FNT, Brushes.Black, New PointF With {.X = 132 + FX, .Y = 50.5 + FY})
                    '-金额
                    g.DrawString(FAcc8Box.Value, FNT, Brushes.Black, New PointF With {.X = 156 + FX, .Y = 50.5 + FY})
                End If
            End If


            '--第四行
            If Not FItem9Box.Text Is Nothing Then
                If FItem9Box.Text.Trim <> String.Empty Then
                    g.DrawString(FItem9Box.Text.Trim, FNT, Brushes.Black, New PointF With {.X = 20 + FX, .Y = 57.5 + FY})
                    '-收费区间
                    g.DrawString(String.Format("{0:yyyy.M.d}-{1:yyyy.M.d}", FSDate9Box.Value, FEDate9Box.Value), FNT1, Brushes.Black, New PointF With {.X = 50 + FX, .Y = 57.5 + FY})
                    '-平米数
                    g.DrawString(FQty9Box.Value, FNT, Brushes.Black, New PointF With {.X = 92 + FX, .Y = 57.5 + FY})
                    '-单价
                    g.DrawString(FPrice9Box.Value, FNT, Brushes.Black, New PointF With {.X = 112 + FX, .Y = 57.5 + FY})
                    '-天数
                    g.DrawString(FDays9Box.Value, FNT, Brushes.Black, New PointF With {.X = 132 + FX, .Y = 57.5 + FY})
                    '-金额
                    g.DrawString(FAcc9Box.Value, FNT, Brushes.Black, New PointF With {.X = 156 + FX, .Y = 57.5 + FY})

                End If
            End If

            '--第五行
            If Not FItem10Box.Text Is Nothing Then
                If FItem10Box.Text.Trim <> String.Empty Then
                    g.DrawString(FItem10Box.Text.Trim, FNT, Brushes.Black, New PointF With {.X = 20 + FX, .Y = 64.5 + FY})
                    '-收费区间
                    g.DrawString(String.Format("{0:yyyy.M.d}-{1:yyyy.M.d}", FSDate10Box.Value, FEDate10Box.Value), FNT1, Brushes.Black, New PointF With {.X = 50 + FX, .Y = 64.5 + FY})
                    '-平米数
                    g.DrawString(FQty10Box.Value, FNT, Brushes.Black, New PointF With {.X = 92 + FX, .Y = 64.5 + FY})
                    '-单价
                    g.DrawString(FPrice10Box.Value, FNT, Brushes.Black, New PointF With {.X = 112 + FX, .Y = 64.5 + FY})
                    '-天数
                    g.DrawString(FDays10Box.Value, FNT, Brushes.Black, New PointF With {.X = 132 + FX, .Y = 64.5 + FY})
                    '-金额
                    g.DrawString(FAcc10Box.Value, FNT, Brushes.Black, New PointF With {.X = 156 + FX, .Y = 64.5 + FY})

                End If
            End If

            '--合计行
            g.DrawString("合计(大写):", FNT, Brushes.Black, New PointF With {.X = 20 + FX, .Y = 71.5 + FY})
            g.DrawString(FControl.MoneyToUpper(CDbl(FAm2label.Text)), FNT, Brushes.Black, New PointF With {.X = 50 + FX, .Y = 71.5 + FY})
            g.DrawString("合计:", FNT, Brushes.Black, New PointF With {.X = 132 + FX, .Y = 71.5 + FY})
            g.DrawString(FAm2label.Text, FNT, Brushes.Black, New PointF With {.X = 156 + FX, .Y = 71.5 + FY})
            '--表尾信息
            g.DrawString(String.Format("收款人签章:             开票人:{0}   收款单位:昌图县百格物业有限公司", FUNameBox.Text), FNT, Brushes.Black, New PointF With {.X = 20 + FX, .Y = 79 + FY})
            '---------------------------------------------第二段结束-------------------------------------------------


            FY += 97

            FNT = New Font("宋体", 20)
            '--打印标题
            g.DrawString(FCaptionLabel.Text, FNT, Brushes.Black, New Point With {.X = 77 + FX, .Y = 0 + FY})
            '--标题下两条线
            g.PageUnit = GraphicsUnit.Display
            g.DrawLine(New Pen(Brushes.Black, 4), FControl.CalcInch(75 + FX), FControl.CalcInch(8 + FY), FControl.CalcInch(140 + FX), FControl.CalcInch(8 + FY))
            g.DrawLine(New Pen(Brushes.Black, 1), FControl.CalcInch(75 + FX), FControl.CalcInch(9 + FY), FControl.CalcInch(140 + FX), FControl.CalcInch(9 + FY))
            '--日期
            e.Graphics.PageUnit = GraphicsUnit.Millimeter
            FNT = New Font("宋体", 12)
            g.DrawString("开票日期:" & FDateBox.Value.ToString("yyyy年MM月dd日"), FNT, Brushes.Black, New PointF With {.X = 80 + FX, .Y = 10 + FY})
            '--交款单位,编号
            g.DrawString("交款单位:" & FNameBox.Text, FNT, Brushes.Black, New PointF(20 + FX, 15 + FY))
            g.DrawString("编    号:" & FBillNoBox.Text, FNT, Brushes.Black, New PointF(135 + FX, 15 + FY))
            '--交款人,验证码
            g.DrawString("交 款 人:" & FCNameBox.Text.Trim, FNT, Brushes.Black, New Point(20 + FX, 22 + FY))
            g.DrawString("验 证 码:" & FVerifyBox.Text.Trim, FNT, Brushes.Black, New Point(135 + FX, 22 + FY))
            '--外框和格线
            g.PageUnit = GraphicsUnit.Display
            rect = New Rectangle(New Point(FControl.CalcInch(19 + FX), FControl.CalcInch(28 + FY)), New Size(FControl.CalcInch(164), FControl.CalcInch(49.2)))
            g.DrawRectangle(Pens.Black, rect)
            g.DrawLine(Pens.Black, FControl.CalcInch(19 + FX), FControl.CalcInch(35 + FY), FControl.CalcInch(183 + FX), FControl.CalcInch(35 + FY))
            g.DrawLine(Pens.Black, FControl.CalcInch(19 + FX), FControl.CalcInch(42 + FY), FControl.CalcInch(183 + FX), FControl.CalcInch(42 + FY))
            g.DrawLine(Pens.Black, FControl.CalcInch(19 + FX), FControl.CalcInch(49 + FY), FControl.CalcInch(183 + FX), FControl.CalcInch(49 + FY))
            g.DrawLine(Pens.Black, FControl.CalcInch(19 + FX), FControl.CalcInch(56 + FY), FControl.CalcInch(183 + FX), FControl.CalcInch(56 + FY))
            g.DrawLine(Pens.Black, FControl.CalcInch(19 + FX), FControl.CalcInch(63 + FY), FControl.CalcInch(183 + FX), FControl.CalcInch(63 + FY))
            g.DrawLine(Pens.Black, FControl.CalcInch(19 + FX), FControl.CalcInch(70 + FY), FControl.CalcInch(183 + FX), FControl.CalcInch(70 + FY))
            '-竖线
            g.DrawLine(Pens.Black, FControl.CalcInch(49 + FX), FControl.CalcInch(28 + FY), FControl.CalcInch(49 + FX), FControl.CalcInch(77 + FY))
            g.DrawLine(Pens.Black, FControl.CalcInch(92 + FX), FControl.CalcInch(28 + FY), FControl.CalcInch(92 + FX), FControl.CalcInch(70 + FY))
            g.DrawLine(Pens.Black, FControl.CalcInch(111 + FX), FControl.CalcInch(28 + FY), FControl.CalcInch(111 + FX), FControl.CalcInch(70 + FY))
            g.DrawLine(Pens.Black, FControl.CalcInch(131 + FX), FControl.CalcInch(28 + FY), FControl.CalcInch(131 + FX), FControl.CalcInch(77 + FY))
            g.DrawLine(Pens.Black, FControl.CalcInch(155 + FX), FControl.CalcInch(28 + FY), FControl.CalcInch(155 + FX), FControl.CalcInch(77 + FY))
            '--标题栏
            g.PageUnit = GraphicsUnit.Millimeter
            FNT = New Font("宋体", 12)
            '-右侧记账联标志
            'g.DrawString("③", FNT, Brushes.Black, New PointF With {.X = 185 + FX, .Y = 39 + FY})
            'g.DrawString("其", FNT, Brushes.Black, New PointF With {.X = 185 + FX, .Y = 45 + FY})
            'g.DrawString("它", FNT, Brushes.Black, New PointF With {.X = 185 + FX, .Y = 50 + FY})
            'g.DrawString("联", FNT, Brushes.Black, New PointF With {.X = 185 + FX, .Y = 55 + FY})
            '-项目
            g.DrawString("项目", FNT, Brushes.Black, New PointF With {.X = 30 + FX, .Y = 30 + FY})
            '-收费区间
            g.DrawString("收费区间", FNT, Brushes.Black, New PointF With {.X = 62 + FX, .Y = 30 + FY})
            '-平米数
            g.DrawString("平米数", FNT, Brushes.Black, New PointF With {.X = 95 + FX, .Y = 30 + FY})
            '-单价
            g.DrawString("元/天.平", FNT, Brushes.Black, New PointF With {.X = 112 + FX, .Y = 30 + FY})
            '-天数
            g.DrawString("天数", FNT, Brushes.Black, New PointF With {.X = 139 + FX, .Y = 30 + FY})
            '-金额
            g.DrawString("金额", FNT, Brushes.Black, New PointF With {.X = 165 + FX, .Y = 30 + FY})
            '-----分录
            '--第一行
            '-项目
            If Not FItem11Box.Text Is Nothing Then
                If FItem11Box.Text.Trim <> String.Empty Then
                    g.DrawString(FItem11Box.Text.Trim, FNT, Brushes.Black, New PointF With {.X = 20 + FX, .Y = 36.5 + FY})
                    '-收费区间
                    g.DrawString(String.Format("{0:yyyy.M.d}-{1:yyyy.M.d}", FSDate11Box.Value, FEDate11Box.Value), FNT1, Brushes.Black, New PointF With {.X = 50 + FX, .Y = 36.5 + FY})
                    '-平米数
                    g.DrawString(FQty11Box.Value, FNT, Brushes.Black, New PointF With {.X = 92 + FX, .Y = 36.5 + FY})
                    '-单价
                    g.DrawString(FPrice11Box.Value, FNT, Brushes.Black, New PointF With {.X = 112 + FX, .Y = 36.5 + FY})
                    '-天数
                    g.DrawString(FDays11Box.Value, FNT, Brushes.Black, New PointF With {.X = 132 + FX, .Y = 36.5 + FY})
                    '-金额
                    g.DrawString(FAcc11Box.Value, FNT, Brushes.Black, New PointF With {.X = 156 + FX, .Y = 36.5 + FY})
                End If
            End If


            '--第二行
            If Not FItem12Box.Text Is Nothing Then
                If FItem12Box.Text.Trim <> String.Empty Then
                    '-项目
                    g.DrawString(FItem12Box.Text.Trim, FNT, Brushes.Black, New PointF With {.X = 20 + FX, .Y = 43.5 + FY})
                    '-收费区间
                    g.DrawString(String.Format("{0:yyyy.M.d}-{1:yyyy.M.d}", FSDate12Box.Value, FEDate12Box.Value), FNT1, Brushes.Black, New PointF With {.X = 50 + FX, .Y = 43.5 + FY})
                    '-平米数
                    g.DrawString(FQty12Box.Value, FNT, Brushes.Black, New PointF With {.X = 92 + FX, .Y = 43.5 + FY})
                    '-单价
                    g.DrawString(FPrice12Box.Value, FNT, Brushes.Black, New PointF With {.X = 112 + FX, .Y = 43.5 + FY})
                    '-天数
                    g.DrawString(FDays12Box.Value, FNT, Brushes.Black, New PointF With {.X = 132 + FX, .Y = 43.5 + FY})
                    '-金额
                    g.DrawString(FAcc12Box.Value, FNT, Brushes.Black, New PointF With {.X = 156 + FX, .Y = 43.5 + FY})

                End If
            End If


            '--第三行
            '-项目
            If Not FItem13Box.Text Is Nothing Then
                If FItem13Box.Text.Trim <> String.Empty Then
                    g.DrawString(FItem13Box.Text.Trim, FNT, Brushes.Black, New PointF With {.X = 20 + FX, .Y = 50.5 + FY})
                    '-收费区间
                    g.DrawString(String.Format("{0:yyyy.M.d}-{1:yyyy.M.d}", FSDate13Box.Value, FEDate13Box.Value), FNT1, Brushes.Black, New PointF With {.X = 50 + FX, .Y = 50.5 + FY})
                    '-平米数
                    g.DrawString(FQty13Box.Value, FNT, Brushes.Black, New PointF With {.X = 92 + FX, .Y = 50.5 + FY})
                    '-单价
                    g.DrawString(FPrice13Box.Value, FNT, Brushes.Black, New PointF With {.X = 112 + FX, .Y = 50.5 + FY})
                    '-天数
                    g.DrawString(FDays13Box.Value, FNT, Brushes.Black, New PointF With {.X = 132 + FX, .Y = 50.5 + FY})
                    '-金额
                    g.DrawString(FAcc13Box.Value, FNT, Brushes.Black, New PointF With {.X = 156 + FX, .Y = 50.5 + FY})
                End If
            End If


            '--第四行
            If Not FItem14Box.Text Is Nothing Then
                If FItem14Box.Text.Trim <> String.Empty Then
                    g.DrawString(FItem14Box.Text.Trim, FNT, Brushes.Black, New PointF With {.X = 20 + FX, .Y = 57.5 + FY})
                    '-收费区间
                    g.DrawString(String.Format("{0:yyyy.M.d}-{1:yyyy.M.d}", FSDate14Box.Value, FEDate14Box.Value), FNT1, Brushes.Black, New PointF With {.X = 50 + FX, .Y = 57.5 + FY})
                    '-平米数
                    g.DrawString(FQty14Box.Value, FNT, Brushes.Black, New PointF With {.X = 92 + FX, .Y = 57.5 + FY})
                    '-单价
                    g.DrawString(FPrice14Box.Value, FNT, Brushes.Black, New PointF With {.X = 112 + FX, .Y = 57.5 + FY})
                    '-天数
                    g.DrawString(FDays14Box.Value, FNT, Brushes.Black, New PointF With {.X = 132 + FX, .Y = 57.5 + FY})
                    '-金额
                    g.DrawString(FAcc14Box.Value, FNT, Brushes.Black, New PointF With {.X = 156 + FX, .Y = 57.5 + FY})

                End If
            End If

            '--第五行
            If Not FItem15Box.Text Is Nothing Then
                If FItem15Box.Text.Trim <> String.Empty Then
                    g.DrawString(FItem15Box.Text.Trim, FNT, Brushes.Black, New PointF With {.X = 20 + FX, .Y = 64.5 + FY})
                    '-收费区间
                    g.DrawString(String.Format("{0:yyyy.M.d}-{1:yyyy.M.d}", FSDate15Box.Value, FEDate15Box.Value), FNT1, Brushes.Black, New PointF With {.X = 50 + FX, .Y = 64.5 + FY})
                    '-平米数
                    g.DrawString(FQty15Box.Value, FNT, Brushes.Black, New PointF With {.X = 92 + FX, .Y = 64.5 + FY})
                    '-单价
                    g.DrawString(FPrice15Box.Value, FNT, Brushes.Black, New PointF With {.X = 112 + FX, .Y = 64.5 + FY})
                    '-天数
                    g.DrawString(FDays15Box.Value, FNT, Brushes.Black, New PointF With {.X = 132 + FX, .Y = 64.5 + FY})
                    '-金额
                    g.DrawString(FAcc15Box.Value, FNT, Brushes.Black, New PointF With {.X = 156 + FX, .Y = 64.5 + FY})

                End If
            End If

            '--合计行
            g.DrawString("合计(大写):", FNT, Brushes.Black, New PointF With {.X = 20 + FX, .Y = 71.5 + FY})
            g.DrawString(FControl.MoneyToUpper(CDbl(FAm3Label.Text)), FNT, Brushes.Black, New PointF With {.X = 50 + FX, .Y = 71.5 + FY})
            g.DrawString("合计:", FNT, Brushes.Black, New PointF With {.X = 132 + FX, .Y = 71.5 + FY})
            g.DrawString(FAm3Label.Text, FNT, Brushes.Black, New PointF With {.X = 156 + FX, .Y = 71.5 + FY})
            '--表尾信息
            g.DrawString(String.Format("收款人签章:             开票人:{0}   收款单位:昌图县百格物业有限公司", FUNameBox.Text), FNT, Brushes.Black, New PointF With {.X = 20 + FX, .Y = 79 + FY})
            '--总计
            FNT = New Font("黑体", 12, FontStyle.Bold)
            g.DrawString(String.Format("总计:{0}       总计(大写):{1}", FAmountSMLabel.Text, FAmountBGLabel.Text), FNT, Brushes.Black, New PointF With {.X = 20 + FX, .Y = 85 + FY})
            'g.DrawString("总计(大写):" & FAmountBGLabel.Text, FNT, Brushes.Black, New PointF With {.X = 20 + FX, .Y = 146 + FY})
        Catch ex As Exception
            MsgBox("生成打印模板失败!" & ex.Message)
            e.Cancel = True
        End Try
    End Sub
#End Region

#Region "禁用所有控件"
    Private Sub FDisCont(ByVal s As Boolean)
        FNameBox.Enabled = s
        FCNameBox.Enabled = s
        FUpBtn.Enabled = s
        FDownBtn.Enabled = s
        FItem1Box.Enabled = s
        FSDate1Box.Enabled = s
        FEDate1Box.Enabled = s
        FQty1Box.Enabled = s
        FPrice1Box.Enabled = s

        FItem2Box.Enabled = s
        FSDate2Box.Enabled = s
        FEDate2Box.Enabled = s
        FQty2Box.Enabled = s
        FPrice2Box.Enabled = s

        FItem3Box.Enabled = s
        FSDate3Box.Enabled = s
        FEDate3Box.Enabled = s
        FQty3Box.Enabled = s
        FPrice3Box.Enabled = s

        FItem4Box.Enabled = s
        FSDate4Box.Enabled = s
        FEDate4Box.Enabled = s
        FQty4Box.Enabled = s
        FPrice4Box.Enabled = s

        FItem5Box.Enabled = s
        FSDate5Box.Enabled = s
        FEDate5Box.Enabled = s
        FQty5Box.Enabled = s
        FPrice5Box.Enabled = s

        FItem6Box.Enabled = s
        FSDate6Box.Enabled = s
        FEDate6Box.Enabled = s
        FQty6Box.Enabled = s
        FPrice6Box.Enabled = s

        FItem7Box.Enabled = s
        FSDate7Box.Enabled = s
        FEDate7Box.Enabled = s
        FQty7Box.Enabled = s
        FPrice7Box.Enabled = s

        FItem8Box.Enabled = s
        FSDate8Box.Enabled = s
        FEDate8Box.Enabled = s
        FQty8Box.Enabled = s
        FPrice8Box.Enabled = s

        FItem9Box.Enabled = s
        FSDate9Box.Enabled = s
        FEDate9Box.Enabled = s
        FQty9Box.Enabled = s
        FPrice9Box.Enabled = s

        FItem10Box.Enabled = s
        FSDate10Box.Enabled = s
        FEDate10Box.Enabled = s
        FQty10Box.Enabled = s
        FPrice10Box.Enabled = s

        FItem11Box.Enabled = s
        FSDate11Box.Enabled = s
        FEDate11Box.Enabled = s
        FQty11Box.Enabled = s
        FPrice11Box.Enabled = s

        FItem12Box.Enabled = s
        FSDate12Box.Enabled = s
        FEDate12Box.Enabled = s
        FQty12Box.Enabled = s
        FPrice12Box.Enabled = s

        FItem13Box.Enabled = s
        FSDate13Box.Enabled = s
        FEDate13Box.Enabled = s
        FQty13Box.Enabled = s
        FPrice13Box.Enabled = s

        FItem14Box.Enabled = s
        FSDate14Box.Enabled = s
        FEDate14Box.Enabled = s
        FQty14Box.Enabled = s
        FPrice14Box.Enabled = s

        FItem15Box.Enabled = s
        FSDate15Box.Enabled = s
        FEDate15Box.Enabled = s
        FQty15Box.Enabled = s
        FPrice15Box.Enabled = s
        FDateBox.Enabled = s
    End Sub
#End Region

    Private Sub FNameBox_SelectedIndexChanged(sender As Object, e As EventArgs) Handles FNameBox.SelectedIndexChanged
        If FComboLock Then
            Return
        End If
        If FNameBox.SelectedValue > 0 Then
            FCNameBox.SelectedIndex = FNameBox.SelectedIndex
        End If
    End Sub
End Class